## Skipping install of 'rsconnect' from a github remote, the SHA1 (b1194acf) has not changed since last install.
## Use `force = TRUE` to force installation
This Notebook is continue of Part -I HR Analytics. Please refer to part- I to know from the begining.
Hourly Income
- Hourly Income | Gender | Department
Highest Paid Position
|
EmpHourlyRate
|
EmpJobRole
|
Gender
|
count
|
|
100
|
Business Analyst
|
Male
|
1
|
|
100
|
Developer
|
Male
|
2
|
|
100
|
Human Resources
|
Male
|
2
|
|
100
|
Manager R&D
|
Female
|
1
|
|
100
|
Research Scientist
|
Male
|
1
|
|
100
|
Sales Executive
|
Female
|
3
|
|
100
|
Sales Executive
|
Male
|
1
|
|
100
|
Sales Representative
|
Female
|
1
|
|
100
|
Senior Developer
|
Male
|
1
|
|
100
|
Technical Lead
|
Male
|
1
|
## Length Class Mode
## 3 formula call

A
- Is it True that Male tends to make less compare to Female.There is a dollar difference in an Median hourly Rate?
- On Average Male and Female throughout the organisation makes more or less around $67 an hour.
B
- When we break it down by the Department we can see their is variation.
- Finance Employee on Average tends to make more and HR employee tends to make Less per hour if we look Median Hourly Rate.
C
- If we took Overall Mean we see Male making $66.02 compare that to Female $65.93.Seems like there is barely any difference.
D
- DS Employee seems to be on low end compare to Rest of the Department.

E
- When we even break it down by Department and Gender we can see some disparities.
- Taking Median Hourly Income is not affected by Outliers which we can see in Human Resource Department.
- When we break it down by the Gender and Department now we can see the Wage disparities.
- There is Huge difference in Human Resource Department, Male making around $71/hr compare to Female $50/hr.
- In Sales Female tends to make $70/hr comapre to Male $62/hr
- In Finance Female tends to make $68.5/hr comapre to Male $76/hr
- But it won’t be True until and unless we consider same Job Role position and Work Experience to make that judgement.
F
- In box plot we can see only outlier which is present in Human Resource Department but there are no any outliers in any other department to make that call.

G
- When considering breaking it down by the Job Role it makes more sense as we can see the variation among the Gender.
- In Some of the Role Female tends to make more than Male and in Some Field Male tends to make more than Female.
- Another factor that need to be reconsider before we make assumption is Years of Experience and their Education level.
- Its harder to compare and reach out to conclusion until and unless we compare apples to apples.
- Variablity factor could be Years of Experience either in current Job or Past Experience, Education level.
H
- Baby Boomers(Age: ) makes more money which does make sense.
- Male Millenials Y.1 makes less money even compare to Female Millenials Y.1.

I
- Is Hourly Rate a Reason for Employees to Leave Department?
- In Some it could be the case but in some it’s Not. In Finance Employee doesn’t seem to live just by Hourly Rate. In others there could be possibility.
J
- We can see Gender Disparities between Genders across Department.
K
- When we break it down by Age group as Employee Age they tend to get paid better, which could be becuase of Senior Role or Experience.
L
- When we break those age group by Gender we can see the Male of Age below 20 seems to be paid badly compared to Female of same Age group.

M & N
- The difference between Employee Leaving the company to staying is very Minimal.
- As this is calculated in hourly Rate, it could rack up huge when you calculated yearly.

O
- One can generalise how Work Experience might count on Employee to either leave or stay.
- We can see that as we move up Experience in years we see more green except one outlier which could possible be retired or death or could left for better opportunities and money.
- But overall as someone has more work experience they seem to stay rather than leave.
P
- In both gender we can see that more you spent gaining more experience you are more likely to not leave the company.
Salary Hike Percent
- Salary Hike Percent across Department
- Salary Hike Percent across age & Dept.
- Salary Hike Percent segregated by Gender
- Salary Hike Percent segregated by Attrition
- Percent Hike and attrition between gender ( iii + v )

A
- We have Salary Hike Percentage ranging from 11% to 25% . If you see its Left Skewed meaning there is more probability that you will have 11-14% of Salary Hike percentage in the beginning and then it slows down.
- If you see the Department we can see Data Science Department(Blue line) stands out than other departments.
B
- There is no bias in Salary Hike Percentage based on Gender.

C
- How does Salary Hike Percentage helps Employee to either stay or leave the company.
- When we break it down by Department we can see in Finance more than 15% and less than 20% have keep the employee to work.
- In Data Science Department Increase Salary has kept employee to not leave the company.
D
- In Finance department Salary Hike Percentage more than 15 and less than 20 % has kept all to work.
- In Data Science field Employee doesnt seem to leave if there is Salary Hike which can be seen in both Gender.
- In Finance all the employee who left beside Salary Hike Percent are all Male.
- In Finance may be if there is Salary Hike Percent, we can keep most of the Female employee from leaving the company.

E
- Overall as performance rating increases the Salary Hike Percentage does increase.
F
- Highest Performance Rating does have edge over Hike Percentage those who stays and those who leave.

G
- Baby Boomers(Age:55 -76) in Data Science and Finance field doesn’t get Hike % compare to rest of the department.
- We can see segregation in HR Millenials Gen Y.2.
H
- We can see some of the interesting features in HR for Employee Age between 20_30 and In Finance between Age 40_50.

I
- Three big department doesn’t care so much about Salary Hike based on our Martial Status.
- In Data Science field we can see Martial Status has some influence.Single are restricted to 20% Hike. Married Employee gets 15% to 20% Hike and flattens out. Divorced are restricted to 20 %
- In Finance Singles are restricted to 20% Salary Hike.
J
- If we look how does the education level have helped employee to get more salary hike percent, we can see again interesting pattern in Data Science department.
- No college Degree and PhD employee doesnt get any salary increment.
- In Finance we can see segregation in PhD Employee. There are employee who get Salary Hike Percent around 15% and then there are very few Employee who gets around 25%.
- One can say it might depend upon Job Role and experience than education which we can look by Job Role.

K
- Median hike percentage.
- All the job Roles start at 11% Hike except Delivery manager and Technical Architect who gets 12% Hike.
- There are some jobs which gets more Hike % than others.
- Developer & Sales Executive have variation in Hike % more than any other jobs.

L
- When we try to break it down by Department we can see Interesting patterns
- Data Science Employees have performance Rating of only 3.
- Their Salary Hike Percentage is maximum upto 20%.
- Either Low or High Performance Rating Data Scinetist doesnt get any Salary Hike Percentage.
- For rest of the Department even if you have low Performance rating you still can get upto 25% Salary hike.
- If you have Performance Rating of 4 majority of the employee gets more than 20% Salary Hike.
M
- As we have more Male Employee we can see Attrition has been condensed in Male Employee whereas it has been spread out in Female.
Select by Freq
- In our datasets about 9.92% of Employee of Male Age between 30-40 have got 14-16% Salary Hike.
- In our datasets about 5.42% of Employee of Female Age between 30-40 have got 11-13% Salary Hike as we don’t have equal number of Males and Female in our datasets it makes sense. It doesnt mean that there is any biases as we have shown in bar plot chart that they are treated equally interms of hike Percentage.
- In our datasets about 11.17% of Employee from Sales Department got 14-16% Salary Hike which is the biggest.
- In our datasets about 10.50% of Employee from Development Department got 14-16% Salary Hike which is the biggest.
- In our datasets about 10.17% of Employee from R&D Department got 14-16% Salary Hike which is the biggest.
ATTRITION
Our main question for doing all this Exploratory data analysis beside finding the Relationhsip between the variables is also to understand the Attrition Rates and diagnose the cause and find useful insights. Lets look at the Attrition Number of our datasets.
Attrition by Age

A
- As we have look into all the components, now its time to see how is the attrition distrbuted across various variables.
- In Finance department we can see the younger Employee seems to leave the company.
- In Data Science also we can see clear differentiation.
- In Human Resource we can also early retention but after mean age they are less likely to leave the company.
- Looking through out the department.
B
-Younger Employee tends to leave the company than to stay. - After Age 35 we can see more Employees tends to stay than to leave the company could be because of Financial Stability and years of experience to settle down.

C
- Interesting Features in education level PhD.Rest of the education levels is somewhat more or less similar.
D
- Martial status does have some effect on Attrition.Just look at geom density between Single and rest.
Attrition Number & Percentage by Gender

E & F
- 15% Leave the company while 85% still do work there.
- Out of 15 % who leave the company 16% are Male and 13% are Female.
- Average age of Employee who doesnt leave the company falls in Mean age of Entire Population of the workforce. Mean Age of the Employee who leave the company have less mean age in both Gender.Red Astrick Represents the outliers.
Attrition by Dept. & Gender

G
- As guessed we have biggest number of attrition coming from 3 big department Sales leading the more attrition than any other department.
H
- When we break it down by the Gender we can see that Males and Females leave the company at the same rate.
- In Finance we saw 2% Employee leaving the company and its all Male.None of the Female left the company.
- Most of the Female Working in Human Resource department seems to leave the company. Out of 4% of total attrition 24% of the Employee seems to be Female which is double than Male 11% leaving the company.
Attrition Number by Employee Job Role
Lets look if we could find some insights in the job Role. May be this could give us some insights on how the Attrition factor plays any role.

- Sales Representative contribute more for the attrition. Almost about 35% of them leave the company.
- Out of 35% Male and Female almost participate roughly equally. 54% are Female and 44% are Male.
- 3% Technical Lead are all Male.
- Seconds is Technical Architect.About 29% of Technical Architect leave the company and all of them who leave the company are Male.
- Senior Manager R&D. 13% Employee leave out of which half of them are Male and other half is Female.
- Research Director never leaves the company at all.
- 4% Manager who leaves the company are all Female.
- 3% Healthcare Representative who leave the company are all Male.
- 6% Finance Manager who leaves the company are all Male.
- Delivery Managers never leave the company at all.
- 10 % Data scientist who leave the company. Half of them are female.
- 6% Business Analyst who leave the company are all Male.
Looking at above insights company can see the patterns coming out of particular Gender and then decide what factors might result them to leave the company.
- I have subset trying to find if there is any insights among any of the variables.
- There are in total 8 Employee who have left the company who are all Male.
EmpJobRole with Attrition YES
|
EmpNumber
|
Age
|
Gender
|
EducationBackground
|
MaritalStatus
|
EmpDepartment
|
EmpJobRole
|
BusinessTravelFrequency
|
DistanceFromHome
|
EmpEducationLevel
|
EmpEnvironmentSatisfaction
|
EmpHourlyRate
|
EmpJobInvolvement
|
EmpJobLevel
|
EmpJobSatisfaction
|
NumCompaniesWorked
|
OverTime
|
EmpLastSalaryHikePercent
|
EmpRelationshipSatisfaction
|
TotalWorkExperienceInYears
|
TrainingTimesLastYear
|
EmpWorkLifeBalance
|
ExperienceYearsAtThisCompany
|
ExperienceYearsInCurrentRole
|
YearsSinceLastPromotion
|
YearsWithCurrManager
|
Attrition
|
PerformanceRating
|
Educational_Levels
|
Age_bin
|
Generation
|
Hike_Pct
|
CatYearsManager
|
hourly_bin
|
|
E1001405
|
39
|
Male
|
Life Sciences
|
Divorced
|
R&D
|
Healthcare Representative
|
Travel_Frequently
|
2
|
3
|
1
|
84
|
3
|
4
|
4
|
7
|
No
|
11
|
4
|
21
|
4
|
3
|
18
|
7
|
11
|
5
|
Yes
|
2
|
Bachelors Degree
|
30_40
|
Gen Xers
|
11-13
|
2-5 Years hired
|
80_89
|
|
E1001882
|
28
|
Male
|
Medical
|
Married
|
Finance
|
Finance Manager
|
Travel_Rarely
|
24
|
3
|
3
|
51
|
3
|
1
|
2
|
1
|
Yes
|
17
|
3
|
1
|
3
|
3
|
1
|
1
|
0
|
0
|
Yes
|
3
|
Bachelors Degree
|
20_30
|
Millenials Gen Y.1
|
17-20
|
Recently Hired Newbie
|
50_59
|
|
E1001962
|
23
|
Male
|
Medical
|
Single
|
Finance
|
Finance Manager
|
Travel_Rarely
|
8
|
1
|
4
|
93
|
2
|
1
|
3
|
1
|
Yes
|
11
|
1
|
5
|
2
|
3
|
5
|
4
|
1
|
2
|
Yes
|
3
|
No College Degree
|
20_30
|
Millenials Gen Y.1
|
11-13
|
1-2 years Old
|
90_100
|
|
E1001970
|
32
|
Male
|
Life Sciences
|
Single
|
Finance
|
Finance Manager
|
Travel_Rarely
|
2
|
4
|
4
|
95
|
3
|
1
|
2
|
1
|
No
|
12
|
1
|
1
|
2
|
3
|
1
|
0
|
0
|
0
|
Yes
|
3
|
Masters Degree
|
30_40
|
Millenials Gen Y.2
|
11-13
|
Recently Hired Newbie
|
90_100
|
|
E100333
|
26
|
Male
|
Life Sciences
|
Single
|
Development
|
Technical Architect
|
Travel_Rarely
|
25
|
3
|
1
|
48
|
1
|
1
|
3
|
1
|
No
|
12
|
3
|
1
|
2
|
2
|
1
|
0
|
0
|
1
|
Yes
|
3
|
Bachelors Degree
|
20_30
|
Millenials Gen Y.1
|
11-13
|
1-2 years Old
|
40_49
|
|
E100343
|
28
|
Male
|
Technical Degree
|
Single
|
Development
|
Technical Architect
|
Travel_Rarely
|
5
|
4
|
3
|
50
|
3
|
1
|
3
|
1
|
Yes
|
13
|
3
|
2
|
3
|
2
|
2
|
2
|
2
|
2
|
Yes
|
3
|
Masters Degree
|
20_30
|
Millenials Gen Y.1
|
14-16
|
1-2 years Old
|
50_59
|
|
E100457
|
51
|
Male
|
Life Sciences
|
Single
|
Development
|
Business Analyst
|
Travel_Frequently
|
8
|
4
|
1
|
53
|
1
|
3
|
4
|
2
|
No
|
15
|
4
|
18
|
2
|
3
|
4
|
2
|
0
|
3
|
Yes
|
4
|
Masters Degree
|
50_60
|
Gen Xers
|
14-16
|
2-5 Years hired
|
50_59
|
|
E100560
|
38
|
Male
|
Medical
|
Married
|
Development
|
Technical Lead
|
Travel_Rarely
|
29
|
1
|
2
|
70
|
3
|
2
|
1
|
7
|
Yes
|
19
|
2
|
17
|
2
|
3
|
1
|
0
|
0
|
0
|
Yes
|
3
|
No College Degree
|
30_40
|
Millenials Gen Y.2
|
17-20
|
Recently Hired Newbie
|
70_79
|
ANALYSIS
- 5 out of 8 are Single.
- 4 Works in Development, 3 works in Finance and 1 in R&D
- 3 are Finance Manager, 2 are Technical Architect, 1 Technical Lead, 1 Business Analyst and 1 is Healthcare Representative.
- 6 out of 8 Travel Rarely.
- 3 out of 8 leave very far from Home.
- 5 out of 8 have Job Involvment category 3.
- 5 out of 8 have Job level 1.
- 5 out of 8 have worked only one previous company.
- 4 have worked OverTime and 3 have Not.
- Salary Hike Percent is from 11-19.
- 3 of them have Workexperience of more than 17 years.
- 6 out of 8 have WorkLife Balance score of 3 which is Better.
- 4 out of them have just spend about a year in this company.
- 5 out of 8 have been promoted last year.
- One of them is working for 5 years with Current Managers while rest of them have either 0,1,2,3 years with current Manager. Could this be one of the crucial factor for them to leave.
- 6 out of 8 have performance rating of 3.
- 3 have Bachelor Degree, 3 have Master Degree and 2 of them have No college Degree.
one of them makes Hourly between 40-49, 3 of them makes between 50-59, 2 of them makes between 90-100$ an hour.
- We have seen Single leaving the company so Single creates High Volatility.
- Did 3 of them who have Bachelor degree left to get Higher Education Degree.
- All of them have Salary Hike percent.
- Was Current Managers somehow responsible for Employee to leave.
We could deep digger to find out if cuurent Managers was somehow responsible for Employee to leave by categorising Employee who stayed under Current Manager and who left.
## 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
##
## Business Analyst No 4 1 2 2 2 0 0 2 2 0 0 0 0 0 0 0 0 0
## Yes 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Data Scientist No 5 1 2 0 3 0 0 3 2 1 0 1 0 0 0 0 0 0
## Yes 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Delivery Manager No 2 1 2 0 1 0 0 2 0 1 1 0 0 1 0 0 0 1
## Yes 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Developer No 34 8 52 20 11 8 3 16 17 10 4 4 3 1 0 3 0 2
## Yes 15 6 5 3 2 1 2 4 2 0 0 0 0 0 0 0 0 0
## Finance Manager No 3 2 15 5 3 0 1 7 2 2 2 2 1 1 0 0 0 0
## Yes 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Healthcare Representative No 5 3 5 1 2 0 2 7 0 6 0 1 0 0 0 0 0 0
## Yes 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
## Human Resources No 3 2 11 4 6 0 1 5 4 1 0 0 0 0 0 0 0 0
## Yes 3 0 4 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
## Laboratory Technician No 8 2 19 6 3 1 1 6 3 0 2 0 0 0 0 0 0 0
## Yes 7 0 3 0 0 0 0 2 1 0 0 0 0 0 0 0 0 0
## Manager No 9 4 4 0 4 0 2 8 3 4 3 1 3 1 1 0 1 1
## Yes 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0
## Manager R&D No 10 3 18 10 7 4 2 15 4 3 1 1 1 2 0 0 1 0
## Yes 6 1 1 2 0 0 1 1 0 0 0 0 0 0 0 0 0 0
## Manufacturing Director No 1 1 7 3 4 0 0 5 5 1 1 1 1 0 0 0 0 0
## Yes 0 0 0 0 1 0 0 0 0 2 0 0 0 0 0 0 0 0
## Research Director No 4 0 2 0 0 0 0 4 3 3 1 1 0 1 0 0 0 0
## Yes 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Research Scientist No 13 6 17 8 3 0 1 8 4 0 1 1 1 0 0 0 0 1
## Yes 6 0 2 2 0 0 0 2 1 0 0 0 0 0 0 0 0 0
## Sales Executive No 24 13 37 21 23 9 7 47 17 13 3 4 4 3 0 0 0 1
## Yes 9 2 9 5 2 1 0 9 3 1 2 0 0 0 1 0 0 0
## Sales Representative No 15 1 22 1 0 1 2 1 2 0 0 0 0 0 0 0 0 0
## Yes 13 0 9 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0
## Senior Developer No 7 3 10 1 4 0 2 8 8 1 0 1 0 0 0 0 0 0
## Yes 0 1 3 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0
## Senior Manager R&D No 0 1 5 2 0 0 0 3 2 0 0 0 0 0 0 0 0 0
## Yes 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
## Technical Architect No 1 1 0 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0
## Yes 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## Technical Lead No 3 3 12 4 2 0 0 7 2 2 1 1 0 0 0 0 0 0
## Yes 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
- When I break it with Current Managers I didn’t find any concurrent evidence.
Attrition by Job Role And Age_bin

- We can see bell shape curve in both people who stays and work and people who leaves the company.
- Senior Developer, Sales Representative, Manager R&D, Healthcare Representative have early turnover before the mean age of Entire workforce.
- Blue dotted lines represent Mean Age of Workforce.
- Only Manufacturing Directors who tend to leave the company around the retirement Age.
JobSatisfaction & Attrition
How does the Job Satisfaction level play a role in terms of Attrition.

How does the Salary Increment affects the Attrition Rate Differentaited by the Gender.
Hourly Income by Department & Attrition
How is Hourly Rate distributed across various Department?

Hourly Rate and its Impact on Attrition

We will see some more variables and how does it affect the attrition level. Some of the factors like overtime, Martial Status, Performance Rating and Last Salary hike percent can be considered in finding some interesting observations.
- We can observe that Higher Salary/hour person are less likely to leave if the salary Hike percent is more than 15. - We can see some cluster at the bottom and spread out at the top.
- Overtime Employee that are paid less hourly leaves the company than that are well paid.
- low performance rating who tends to leave the company are less paid averaging somewhere around $61-$65
- People who leave the company: Single Status Employee make more hourly than Married and divorced
- But incase of people who stays seems to have have same average hourly income.
Wage disparities among Department | Gender | Attrition


- As we can see it’s not true that Females do make less money hourly in same position. It depends upon the Job Role.
- In some Job Role they seems to make more money hourly than Male as we can see that in Sales Executive Role,Research Scientist Role,Technical Architecture and many more.
- As we can see Females are paid less Hourly compare to Male after we grouped by Same job Role.
- As we can see it to be True in Human Resource mostly, Development, Finance.
- But incase of Sales that is not true that could be reason we have seen more Female in Sales Department than Men.
- In the field of Data Science Female tends to make more hourly than Male.
Let’s group by EmpJobRole,TotalWorkExperienceInYears,ExperienceYearsInCurrentRole,EmpHourlyRate, Education level & Gender and see if this still holds true.
As we can see yes there is some wage disparities among male and Female although they have same or almost similar level of experience in certian roles. - It can be mostly seen in Development, Finance, HR department. - In HR there are some outliers as well in Female Popultaion. - It is also true that Men are paid quite less in Sales, R&D department. - In DS field womens are paid quite more for same job role and experience than Male even after considering all the possible factors.
Education level & Attrition
How does the Level of Education play role in leaving the company.
In terms of ranking who are more likely to leave are - 19% Workforce who doesn’t have any college degree. - 15% Workforce who have only college degree - 15% Workforce who have only Bachelor degree - 13 % Workforce who have only Master Degree. - 12 % Workforce who have highest degree Phd. - When we break down by gender we can see Male population who have Master degree(76%) are more likely to leave and on Female side (~60%) who have Phd.
Percent Difference (%)

Correlationship Matrix.

- Can see the pearson Correlation between the variables.
- Top Right corner, you can see most of them are highly correalated.
- Which I have shown in the realtionship between Bivariates.
YOU MADE IT
- I know its pretty long rather than breaking it down into multiple Notebooks I thought of compiling into two notebook. Thank you for Reading the Post.Hope you enjoyed reading as much as “fun” I had making it.
Please do provide feedback/comment if you like any part of it. Would like to do better in future projects.
- I know its pretty long rather than breaking it down I thought of compiling single notebook. Thank you for Reading the Post.Hope you enjoyed reading as much as “fun” I had making it.
Please do provide feedback/comment if you like any part of it. Would like to do better in future projects.
🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏