Menu

This exploratory data analysis (EDA) aims to answer the following questions

1. What department had the highest percentage of attrition?
2. How many segments of attrition did the company have?
3. Did employees with high satisfaction or review tend to stay at the company? As they were satisfied with their jobs and got a good review, they would not want to leave, right?
4. Did people with high tenure would work the hardest as they are, well, experienced? Or in fact, those who worked hard were those with less experience?
5. When you worked more, got a good review, you were supposed to get paid more, right?

The dataset is posted at Kaggle (Link.) Assume that you are the CEO and HR is presenting this dataset and analysis to you; let’s see what we can do with it. But before the bread and butter, we need to do some prep works.

First, we need to load packages.

Next, let’s load the data and change it to a Tibble format.

Now, let’s see what we have.

We have 10 variables: 1 dependent (left) and 9 independents over 14,999 observations. As we will focus on EDA, I will change the name to be shorter so that I don’t have to type much and will change some integer variable to factor. Also, I will create a sorting function, chart position, and theme that will aid in visualization.

Okay. Let’s see the result.

That’s better and shorter to type. Alright, before doing any EDA, let’s see if we have any missing values.

Okay, 14,999 by 10… and there is no missing value… good. Let’s start by visualizing how many employees have left.

23% (3,571 employees) left the company. I wonder what department contributed to attrition. But before that, let’s take a look at the headcounts in each department.

Hm, 28% of the entire company was in sales. I’d guess most of the attrition came from Sales department as the department is generally goal-driven, which could be a very convenient criterion for firing people. Let’s check the assumption.

As expected… 28% of attrition came from the Sales department. But that is just one side of the story. We need to see the percentage of attrition within each department.

Well, it turned out that, Sales was not so bad after all. But only 14% attrition in Management? Well, no doubt about it. :-/ HR was interesting as it had the highest attrition rate.

Now let’s focus on those who left the company.  Let’s take a look at 4 variables that should give some hints with the following assumptions:

• Satisfaction: Lower satisfaction, more likely to quit
• No. of Project: Too many projects, more likely to quit
• Last Evaluation: Lower last evaluation, more likely to quit
• Avg Mth Hours: High hours, more likely to quit

First, let’s see Satisfaction and Number of Project.

Oh, that’s a bingo. Haha. Yikes. It seems like the healthiest number of a project is 3. The more the projects, the higher the attrition rate. What about Hours and Evaluation?

Oh, that is interesting. Many of the assumptions turned out to be correct. But there also are some surprising results: Employees with high satisfaction and high evaluation quit. In addition to Satisfaction and Evaluation, those with relatively low work hours also quit.

Let’s create charts that combine 5 features (Department, Evaluation, Number of Project, Left, and Satisfaction Level.) I’ll assign the Satisfaction Level to the size: the bigger, the happier and vice versa. First, let’s try with HR.

Oh, now we know why people who worked 7 projects quit… they were unhappy! The size of the jitters is significantly different from the rest. Let’s compare HR with Sales.

Yep, that’s the same story. Now we know that the magic quadrants are upper right and bottom left. Let’s see if other departments also had the same pattern.

Okay, Accounting and IT had the same pattern. What about Marketing and Technical?

Same old pattern, let’s take a look at the other 4 departments.

Yep, every department had the same pattern. However, if you take a look closely, you would see that there is a huge chunk of quitters at 4 to 5 projects; it is most apparent technical. I could just use Dplyr to filter only quitters and redo the chart. But I think the chart below is better at visualizing.

There we go, there is actually 3 clusters of attrition. First, those with high evaluation but low satisfaction. Second, those with high evaluation and high satisfaction. Third, low evaluation but high satisfaction. At this point, I’d guess those who worked more were top performers and unhappy as they overworked… so they just quit. It makes sense, right? If you are good, you should be able to get a new job anyway. While the second group may have just got bored and got an offer that they could refuse (sounds familiar?) While the last group who worked on only 2 projects and got low evaluation were, unfortunately, forced out or fired.

Come to think about it… we have a Tenure feature. I am just curious about compensation and tenure. I mean, if I were to work 7 projects and got paid half a million, really, I may just suck it up for a couple of years and retire. Generally, those who work more, should get paid more, right?

Oh, that sucks! No doubt they quit! Look at those red dots; they only work on 3 to 5 projects. Tenure should come into play. My guess is those youngsters had to work on many projects and got paid low, while those with many years of work experience worked on fewer projects but got paid much higher

Well, look at that. Those with 4 to 6 years of tenure were like in their prime (in a bad way.) While the newcomers got to work only on few projects as probably due to being new. While those with  6 or more years of tenure worked very few… sounds super familiar.

But wait, if those labors didn’t get paid high, who, then, got fat checks? I wonder what it would look like if we find salary percentage in each department.

Of course, Management!!

By this time we should be able to answer the questions

1. What department had the highest percentage of attrition?
HR at 29%, Accounting at 27%, Technical at 26%
2. How many segments of attrition did the company have?
There are 3 types of attrition. First, top performers. These employees were assigned to work on too many projects eventually resulting in unhappiness and attrition. Second, boredom. These employees were happy at work and got good evaluation, but they quit probably due to boredom of doing the same works. Third, under performers. These employees got low evaluation and worked on few projects. They probably got forced out.
3. Did employees with high satisfaction or review tend to stay at the company?  As they were satisfied with their jobs and got a good review, they would not want to leave, right? Nope! Not at all. It appears that there were 2 types of resigned top performers. First, those that were assigned to too many projects resulting in low satisfaction and resignation. Second, those with high satisfaction but resigned due to, well, probably an offer that they could not refuse from other companies.
4. Did people with high tenure would work the hardest as they are, well, experienced? Or in fact, those who worked hard were those with less experience? No, they didn’t work the hardest. Those who worked hardest were those with 4 to 6 years of tenure.
5. When you worked more, got a good review, you were supposed to get paid more, right?  Well, that couldn’t be further from the truth. Those who worked on 7 projects despite getting high review got paid either low or medium. In every department, the percentage of those who got paid “high” was between 6 % and 10% only. But guess what, 36% of management got paid “high.” Surprise! Surprise!