Age, Time at Company, and Job Loss: Analysis Using R
- Scott C
- May 28, 2023
- 5 min read
Updated: Jun 6, 2023

Introduction:
One of the worst feelings in the world can be when someone loses their job. Employees can also leave the company for other reasons whether related to pay or possibly due to the commute. In this study, we are taking a look at data that is from the HR department at IBM. Management at IBM is trying to determine what demographics correlate with why people are leaving the company.
Key Points:
From the study we were able to figure out a few different interesting factors.
There is a strong relationship between age and monthly pay
There is a strong relationship between number of years worked and monthly pay
The main reason for being let go appears to be related to the age of the worker
Data:
The data can be found here from Kaggle. The data set is an augmented version created by a real IBM data scientist. The data included education, job satisfaction, age, salary, and other factors. The main focus for the data is IBM HR looking into Employee Attrition and performance.
Analysis:
The first step in the analysis was trying to compare age, distance from home, education, pay rates , monthly income, number of companies the person has worked for, how long they've worked, and how much training they have done. The closer a value is to 1 or -1 the stronger the linear relationship.

The key take away here is that the strongest linear relationship is between age and the total working years (0.680). The next strongest relationship is between age and monthly income(~0.498). The next closest relationship was education (0.208).
Based on this information we created a scatterplot so we could further compare and visualize how each of the variables were related. The variables monthly income, age, total working years, and education were compared based on the higher linear relationships.

By looking at the graphs, there is a similar pattern related to the linear relationships from before. Total working years and age had the strongest relationship and they have the most clear linear relationship. When looking at monthly and age, as well as, monthly income and total working years, there appears to be a huge shift in pay when the worker reaches the age of 40.
Following this, it was important to find out how age relates to attrition. By looking at the box plot below the dark line represents the median value. In this case it looks like those who got fired tended to be younger. This is also the case when looking at the deviations between the two. The highest point for no is older than the highest point for yes.

It is important to confirm these results by seeing if they are significantly different. A Welch Two Sample t-test was used to find out the significance between age and the attrition.

The important values to look at here are the p-values. We look for p-values that are less than 0.05. This indicates that we can confidently say with 95% certainty that the two variables are related. This p-value displayed is nearly 100% showing a strong relationship.
Due to a disgruntled employee, they believe that they were fired because they were hired earlier than older employees. This is the idea of last hired, first fired. To find this, again a box plot was created to look into this. The box plot below shows two median values that are nearly identical no showing a clear difference.

When looking at the p-value of 0.6768, there doesn't appear to be a clear correlation between when the employee was hired, compared if to if they were fired or not.

Following these tests, it was important to further look into the relationships between the different variables. In this case, a linear regression was used. The idea is looking for how close the two variables fit a line. This indicates the type of relationship between the two variables.

The results for the linear regression above, the p-value is 2.2e-16. This is nearly 0 indicating the relationship is statistically significant. We can say this with 95% confidence. The R-squared value is 0.2479. This means that 25% of the variance in the monthly income can be explained using the age variable.
One type of statistical test is able to make comparisons using multiple x variables at once. This is called a multivariate linear regression.

In this case, we are looking at how age and total working years relate to the monthly income. In this case with a p-value of 2.2e-16, which is almost 0, we can confidently say with 95% confidence there is significant relationship between monthly income, age, and total working hours. When combining both variables, the r-squared test has a value of 0.5988 With the addition of the total working years, we can say that both age and total working years explains 60% of the variance between monthly income.
Main Takeaway:
There are a few key points that can be gathered from this data.
There is a strong relationship between age and monthly pay
There is a strong relationship between number of years worked and monthly pay
The main reason for being let go appears to be related to the age of the worker and how long they have been with the company
What now?
The main point of this analysis was to explain why particular employees are leaving the company. When it comes to firings, being younger is the biggest impact. The employer would need to find incentives to keep the younger workers. Some of these incentives could be related to the monthly pay.
A Pew Research study showed that low pay and opportunities for advancement are two of the key reasons for leaving a company. When looking at the statistics, there is a strong correlation of number of years at the company an the pay. The employer would need to find ways for younger workers to move up in the company. One possible course of action could be to have a mentor for the worker. The mentor can help provide confidence in the worker and provide constructive criticism allowing for a better overall performance.
The company could also provide hiring bonuses to help get younger employees into the company. Most changes in pay have been from people leaving companies than people staying with the companies. The company would need to provide more incentives and significant enough pay raises for the worker to feel respected and worth it. Overall the important is to find ways to retain employees in relation to pay. The better the pay, the more likely the worker will feel their worth and stay on. The average number of job changes is now up to 12 times. Many years ago, most people stayed with the same company for life. If a company wants better attrition, they need to provide the pay, advancement, other factors such as good work life balance for the younger generation to stay on.



Comments