Employee Attrition refres to when a company employee choose to leave when company to work for other company. Employee attrition is a very common process across organizations. Vraious employee leave one company for other company just becuase of some benifits. The benefits depend on employee to employee like some may be better compansation, distance from home, better growth Opportunity, better skillset training, betterrole, environmant factors, bad relationship with managers etc.
The analysis has been carried to find out the most important factor that affect employee’s attrition. The opposite of attrition is retention. As employee’s attrition very negatively affect companies growth, every year companies come with different retention schemes for employee so employees dont leave the company. Those method include retention bonuses, better training, promotion and stock option which mature after som definite period. So finding the important factor for attrition will help organization to plan their retention schemes more targeted.
In this study we will study Data created by IBM data scientist involving various factors of employee. Though the data is fictious but since the data is used by data scientist of a reputed company it can be considered for a explorartory study.
The dataset consist information of 1470 employees with their 35 Characteristics including their Attrition/Retention status
The factors that are included in this Dataset are:
Since some variable have values in character form so they were converted into numeric form as follow
EducationField -> EducationField1,“Human Resources” = 1, “Life Sciences”=2, “Marketing”= 3, “Medical” = 4, “Other” = 5, “Technical Degree” = 6
Gender -> Gender1,“Female” = 1, “Male” = 2
JobRole -> JobRole1,“Human Resources”= 1, “Healthcare Representative”= 2, “Laboratory Technician” = 3, “Manager”= 4, “Manufacturing Director” = 5, “Research Director” = 6, “Research Scientist” = 7, “Sales Executive” =8, “Sales Representative”= 9
MaritalStatus-> MaritalStatus1“Divorced”= 1,“Married”=2“Single”= 3
OverTime -> OverTime1, “Yes”=1, “No”= 0
setwd("E:/Internship/Tasks/Project")
Employeedata <-read.csv(paste("HR-Employee-Attrition.csv",sep=""))
View(Employeedata)
Employeedata$Attrition1[Employeedata$Attrition== "Yes"] <-1
Employeedata$Attrition1[Employeedata$Attrition== "No"] <-0
Employeedata$BusinessTravel1[Employeedata$BusinessTravel== "Non-Travel"] <-1
Employeedata$BusinessTravel1[Employeedata$BusinessTravel== "Travel_Rarely"] <-2
Employeedata$BusinessTravel1[Employeedata$BusinessTravel== "Travel_Frequently"] <-3
Employeedata$Department1[Employeedata$Department== "Human Resources"] <-1
Employeedata$Department1[Employeedata$Department== "Research & Development"] <-2
Employeedata$Department1[Employeedata$Department== "Sales"] <-3
Employeedata$EducationField1[Employeedata$EducationField== "Human Resources"] <-1
Employeedata$EducationField1[Employeedata$EducationField== "Life Sciences"] <-2
Employeedata$EducationField1[Employeedata$EducationField== "Marketing"] <-3
Employeedata$EducationField1[Employeedata$EducationField== "Medical"] <-4
Employeedata$EducationField1[Employeedata$EducationField== "Other"] <-5
Employeedata$EducationField1[Employeedata$EducationField== "Technical Degree"] <-6
Employeedata$Gender1[Employeedata$Gender== "Female"] <-1
Employeedata$Gender1[Employeedata$Gender== "Male"] <-2
Employeedata$JobRole1[Employeedata$JobRole== "Human Resources"] <-1
Employeedata$JobRole1[Employeedata$JobRole== "Healthcare Representative"] <-2
Employeedata$JobRole1[Employeedata$JobRole== "Laboratory Technician"] <-3
Employeedata$JobRole1[Employeedata$JobRole== "Manager"] <-4
Employeedata$JobRole1[Employeedata$JobRole== "Manufacturing Director"] <-5
Employeedata$JobRole1[Employeedata$JobRole== "Research Director"] <-6
Employeedata$JobRole1[Employeedata$JobRole== "Research Scientist"] <-7
Employeedata$JobRole1[Employeedata$JobRole== "Sales Executive"] <-8
Employeedata$JobRole1[Employeedata$JobRole== "Sales Representative"] <-9
Employeedata$MaritalStatus1[Employeedata$MaritalStatus== "Divorced"] <-1
Employeedata$MaritalStatus1[Employeedata$MaritalStatus== "Married"] <-2
Employeedata$MaritalStatus1[Employeedata$MaritalStatus== "Single"] <-3
Employeedata$OverTime1[Employeedata$OverTime== "Yes"] <-1
Employeedata$OverTime1[Employeedata$OverTime== "No"] <-0
dim(Employeedata)
## [1] 1470 43
Num <- subset(Employeedata, select = c(1,4,6,7,11,13,14,15,17,19,20,21,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43))
View(Num)
Modelling Attrtion as a function of ï..Age, BusinessTravel1, DailyRate, Department1, DistanceFromHome, Education, EducationField1, EnvironmentSatisfaction, Gender1, HourlyRate, JobInvolvement, JobLevel, JobRole1, JobSatisfaction, MaritalStatus1, MonthlyIncome, MonthlyRate, NumCompaniesWorked, OverTime1, PercentSalaryHike, PerformanceRating, RelationshipSatisfaction, StockOptionLevel, TotalWorkingYears, TrainingTimesLastYear, WorkLifeBalance, YearsAtCompany, YearsInCurrentRole, YearsSinceLastPromotion and YearsWithCurrManager
Model <-lm(Attrition1 ~ ï..Age + BusinessTravel1 + DailyRate + Department1 + DistanceFromHome + Education + EducationField1 + EnvironmentSatisfaction + Gender1 + HourlyRate + JobInvolvement + JobLevel + JobRole1 + JobSatisfaction + MaritalStatus1 + MonthlyIncome + MonthlyRate + NumCompaniesWorked + OverTime1 + PercentSalaryHike + PerformanceRating + RelationshipSatisfaction + StockOptionLevel + TotalWorkingYears + TrainingTimesLastYear + WorkLifeBalance + YearsAtCompany + YearsInCurrentRole + YearsSinceLastPromotion + YearsWithCurrManager, data=Num)
summary(Model)
##
## Call:
## lm(formula = Attrition1 ~ ï..Age + BusinessTravel1 + DailyRate +
## Department1 + DistanceFromHome + Education + EducationField1 +
## EnvironmentSatisfaction + Gender1 + HourlyRate + JobInvolvement +
## JobLevel + JobRole1 + JobSatisfaction + MaritalStatus1 +
## MonthlyIncome + MonthlyRate + NumCompaniesWorked + OverTime1 +
## PercentSalaryHike + PerformanceRating + RelationshipSatisfaction +
## StockOptionLevel + TotalWorkingYears + TrainingTimesLastYear +
## WorkLifeBalance + YearsAtCompany + YearsInCurrentRole + YearsSinceLastPromotion +
## YearsWithCurrManager, data = Num)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.58773 -0.21194 -0.08635 0.07390 1.13505
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.886e-01 1.425e-01 2.728 0.006455 **
## ï..Age -3.783e-03 1.336e-03 -2.832 0.004697 **
## BusinessTravel1 8.250e-02 1.610e-02 5.125 3.37e-07 ***
## DailyRate -3.107e-05 2.135e-05 -1.455 0.145770
## Department1 6.934e-02 2.365e-02 2.932 0.003423 **
## DistanceFromHome 3.525e-03 1.059e-03 3.330 0.000892 ***
## Education 2.293e-04 8.573e-03 0.027 0.978663
## EducationField1 6.534e-03 6.447e-03 1.014 0.310992
## EnvironmentSatisfaction -4.044e-02 7.856e-03 -5.148 3.00e-07 ***
## Gender1 3.898e-02 1.755e-02 2.221 0.026496 *
## HourlyRate -2.528e-04 4.230e-04 -0.598 0.550236
## JobInvolvement -6.148e-02 1.209e-02 -5.087 4.12e-07 ***
## JobLevel -3.477e-02 2.638e-02 -1.318 0.187610
## JobRole1 -6.889e-03 5.197e-03 -1.326 0.185181
## JobSatisfaction -3.861e-02 7.795e-03 -4.953 8.16e-07 ***
## MaritalStatus1 5.329e-02 1.582e-02 3.369 0.000774 ***
## MonthlyIncome 1.108e-06 5.999e-06 0.185 0.853543
## MonthlyRate 5.144e-07 1.205e-06 0.427 0.669557
## NumCompaniesWorked 1.694e-02 3.830e-03 4.423 1.04e-05 ***
## OverTime1 2.073e-01 1.918e-02 10.811 < 2e-16 ***
## PercentSalaryHike -3.448e-03 3.697e-03 -0.933 0.351193
## PerformanceRating 2.318e-02 3.747e-02 0.619 0.536343
## RelationshipSatisfaction -2.193e-02 7.949e-03 -2.759 0.005865 **
## StockOptionLevel -2.389e-02 1.348e-02 -1.773 0.076463 .
## TotalWorkingYears -3.476e-03 2.404e-03 -1.446 0.148328
## TrainingTimesLastYear -1.264e-02 6.681e-03 -1.892 0.058715 .
## WorkLifeBalance -2.774e-02 1.216e-02 -2.282 0.022647 *
## YearsAtCompany 5.993e-03 2.981e-03 2.011 0.044550 *
## YearsInCurrentRole -1.027e-02 3.881e-03 -2.647 0.008213 **
## YearsSinceLastPromotion 1.111e-02 3.421e-03 3.247 0.001193 **
## YearsWithCurrManager -1.046e-02 3.979e-03 -2.628 0.008681 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3263 on 1439 degrees of freedom
## Multiple R-squared: 0.2294, Adjusted R-squared: 0.2133
## F-statistic: 14.28 on 30 and 1439 DF, p-value: < 2.2e-16
We found that some factors affect the attrition of employee very much while some factors totall not. The main factors which cause attrition of employee are age of employee, how much business tarvel he make, in which business department he is involved,office distance from home, enviromant satisfaction,gender,JobInvolvement, his Job Satisfaction rate ,his MaritalStatus,Number of Companies he worked, wherther he does overtime or not, his RelationshipSatisfaction, WorklifeBalance, YearsAtCompany, YearsInCurrentRole,Years Since he lost promoted and Years with current manager
The factor which affect attrition rates are given above.
(because of their positive coefficient in Model)
(because of their negative coefficient in Model)
summary(Employeedata)
## ï..Age Attrition BusinessTravel DailyRate
## Min. :18.00 No :1233 Non-Travel : 150 Min. : 102.0
## 1st Qu.:30.00 Yes: 237 Travel_Frequently: 277 1st Qu.: 465.0
## Median :36.00 Travel_Rarely :1043 Median : 802.0
## Mean :36.92 Mean : 802.5
## 3rd Qu.:43.00 3rd Qu.:1157.0
## Max. :60.00 Max. :1499.0
##
## Department DistanceFromHome Education
## Human Resources : 63 Min. : 1.000 Min. :1.000
## Research & Development:961 1st Qu.: 2.000 1st Qu.:2.000
## Sales :446 Median : 7.000 Median :3.000
## Mean : 9.193 Mean :2.913
## 3rd Qu.:14.000 3rd Qu.:4.000
## Max. :29.000 Max. :5.000
##
## EducationField EmployeeCount EmployeeNumber
## Human Resources : 27 Min. :1 Min. : 1.0
## Life Sciences :606 1st Qu.:1 1st Qu.: 491.2
## Marketing :159 Median :1 Median :1020.5
## Medical :464 Mean :1 Mean :1024.9
## Other : 82 3rd Qu.:1 3rd Qu.:1555.8
## Technical Degree:132 Max. :1 Max. :2068.0
##
## EnvironmentSatisfaction Gender HourlyRate JobInvolvement
## Min. :1.000 Female:588 Min. : 30.00 Min. :1.00
## 1st Qu.:2.000 Male :882 1st Qu.: 48.00 1st Qu.:2.00
## Median :3.000 Median : 66.00 Median :3.00
## Mean :2.722 Mean : 65.89 Mean :2.73
## 3rd Qu.:4.000 3rd Qu.: 83.75 3rd Qu.:3.00
## Max. :4.000 Max. :100.00 Max. :4.00
##
## JobLevel JobRole JobSatisfaction
## Min. :1.000 Sales Executive :326 Min. :1.000
## 1st Qu.:1.000 Research Scientist :292 1st Qu.:2.000
## Median :2.000 Laboratory Technician :259 Median :3.000
## Mean :2.064 Manufacturing Director :145 Mean :2.729
## 3rd Qu.:3.000 Healthcare Representative:131 3rd Qu.:4.000
## Max. :5.000 Manager :102 Max. :4.000
## (Other) :215
## MaritalStatus MonthlyIncome MonthlyRate NumCompaniesWorked
## Divorced:327 Min. : 1009 Min. : 2094 Min. :0.000
## Married :673 1st Qu.: 2911 1st Qu.: 8047 1st Qu.:1.000
## Single :470 Median : 4919 Median :14236 Median :2.000
## Mean : 6503 Mean :14313 Mean :2.693
## 3rd Qu.: 8379 3rd Qu.:20462 3rd Qu.:4.000
## Max. :19999 Max. :26999 Max. :9.000
##
## Over18 OverTime PercentSalaryHike PerformanceRating
## Y:1470 No :1054 Min. :11.00 Min. :3.000
## Yes: 416 1st Qu.:12.00 1st Qu.:3.000
## Median :14.00 Median :3.000
## Mean :15.21 Mean :3.154
## 3rd Qu.:18.00 3rd Qu.:3.000
## Max. :25.00 Max. :4.000
##
## RelationshipSatisfaction StandardHours StockOptionLevel TotalWorkingYears
## Min. :1.000 Min. :80 Min. :0.0000 Min. : 0.00
## 1st Qu.:2.000 1st Qu.:80 1st Qu.:0.0000 1st Qu.: 6.00
## Median :3.000 Median :80 Median :1.0000 Median :10.00
## Mean :2.712 Mean :80 Mean :0.7939 Mean :11.28
## 3rd Qu.:4.000 3rd Qu.:80 3rd Qu.:1.0000 3rd Qu.:15.00
## Max. :4.000 Max. :80 Max. :3.0000 Max. :40.00
##
## TrainingTimesLastYear WorkLifeBalance YearsAtCompany YearsInCurrentRole
## Min. :0.000 Min. :1.000 Min. : 0.000 Min. : 0.000
## 1st Qu.:2.000 1st Qu.:2.000 1st Qu.: 3.000 1st Qu.: 2.000
## Median :3.000 Median :3.000 Median : 5.000 Median : 3.000
## Mean :2.799 Mean :2.761 Mean : 7.008 Mean : 4.229
## 3rd Qu.:3.000 3rd Qu.:3.000 3rd Qu.: 9.000 3rd Qu.: 7.000
## Max. :6.000 Max. :4.000 Max. :40.000 Max. :18.000
##
## YearsSinceLastPromotion YearsWithCurrManager Attrition1
## Min. : 0.000 Min. : 0.000 Min. :0.0000
## 1st Qu.: 0.000 1st Qu.: 2.000 1st Qu.:0.0000
## Median : 1.000 Median : 3.000 Median :0.0000
## Mean : 2.188 Mean : 4.123 Mean :0.1612
## 3rd Qu.: 3.000 3rd Qu.: 7.000 3rd Qu.:0.0000
## Max. :15.000 Max. :17.000 Max. :1.0000
##
## BusinessTravel1 Department1 EducationField1 Gender1
## Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.0
## 1st Qu.:2.000 1st Qu.:2.000 1st Qu.:2.000 1st Qu.:1.0
## Median :2.000 Median :2.000 Median :3.000 Median :2.0
## Mean :2.086 Mean :2.261 Mean :3.248 Mean :1.6
## 3rd Qu.:2.000 3rd Qu.:3.000 3rd Qu.:4.000 3rd Qu.:2.0
## Max. :3.000 Max. :3.000 Max. :6.000 Max. :2.0
##
## JobRole1 MaritalStatus1 OverTime1
## Min. :1.000 Min. :1.000 Min. :0.000
## 1st Qu.:3.000 1st Qu.:2.000 1st Qu.:0.000
## Median :6.000 Median :2.000 Median :0.000
## Mean :5.512 Mean :2.097 Mean :0.283
## 3rd Qu.:8.000 3rd Qu.:3.000 3rd Qu.:1.000
## Max. :9.000 Max. :3.000 Max. :1.000
##
library("psych", lib.loc="~/R/win-library/3.4")
describe(Employeedata)
## vars n mean sd median trimmed
## ï..Age 1 1470 36.92 9.14 36.0 36.47
## Attrition* 2 1470 1.16 0.37 1.0 1.08
## BusinessTravel* 3 1470 2.61 0.67 3.0 2.76
## DailyRate 4 1470 802.49 403.51 802.0 803.83
## Department* 5 1470 2.26 0.53 2.0 2.25
## DistanceFromHome 6 1470 9.19 8.11 7.0 8.08
## Education 7 1470 2.91 1.02 3.0 2.98
## EducationField* 8 1470 3.25 1.33 3.0 3.10
## EmployeeCount 9 1470 1.00 0.00 1.0 1.00
## EmployeeNumber 10 1470 1024.87 602.02 1020.5 1023.40
## EnvironmentSatisfaction 11 1470 2.72 1.09 3.0 2.78
## Gender* 12 1470 1.60 0.49 2.0 1.62
## HourlyRate 13 1470 65.89 20.33 66.0 66.02
## JobInvolvement 14 1470 2.73 0.71 3.0 2.74
## JobLevel 15 1470 2.06 1.11 2.0 1.90
## JobRole* 16 1470 5.46 2.46 6.0 5.61
## JobSatisfaction 17 1470 2.73 1.10 3.0 2.79
## MaritalStatus* 18 1470 2.10 0.73 2.0 2.12
## MonthlyIncome 19 1470 6502.93 4707.96 4919.0 5667.24
## MonthlyRate 20 1470 14313.10 7117.79 14235.5 14286.48
## NumCompaniesWorked 21 1470 2.69 2.50 2.0 2.36
## Over18* 22 1470 1.00 0.00 1.0 1.00
## OverTime* 23 1470 1.28 0.45 1.0 1.23
## PercentSalaryHike 24 1470 15.21 3.66 14.0 14.80
## PerformanceRating 25 1470 3.15 0.36 3.0 3.07
## RelationshipSatisfaction 26 1470 2.71 1.08 3.0 2.77
## StandardHours 27 1470 80.00 0.00 80.0 80.00
## StockOptionLevel 28 1470 0.79 0.85 1.0 0.67
## TotalWorkingYears 29 1470 11.28 7.78 10.0 10.37
## TrainingTimesLastYear 30 1470 2.80 1.29 3.0 2.72
## WorkLifeBalance 31 1470 2.76 0.71 3.0 2.77
## YearsAtCompany 32 1470 7.01 6.13 5.0 5.99
## YearsInCurrentRole 33 1470 4.23 3.62 3.0 3.85
## YearsSinceLastPromotion 34 1470 2.19 3.22 1.0 1.48
## YearsWithCurrManager 35 1470 4.12 3.57 3.0 3.77
## Attrition1 36 1470 0.16 0.37 0.0 0.08
## BusinessTravel1 37 1470 2.09 0.53 2.0 2.11
## Department1 38 1470 2.26 0.53 2.0 2.25
## EducationField1 39 1470 3.25 1.33 3.0 3.10
## Gender1 40 1470 1.60 0.49 2.0 1.62
## JobRole1 41 1470 5.51 2.37 6.0 5.61
## MaritalStatus1 42 1470 2.10 0.73 2.0 2.12
## OverTime1 43 1470 0.28 0.45 0.0 0.23
## mad min max range skew kurtosis se
## ï..Age 8.90 18 60 42 0.41 -0.41 0.24
## Attrition* 0.00 1 2 1 1.84 1.39 0.01
## BusinessTravel* 0.00 1 3 2 -1.44 0.69 0.02
## DailyRate 510.01 102 1499 1397 0.00 -1.21 10.52
## Department* 0.00 1 3 2 0.17 -0.40 0.01
## DistanceFromHome 7.41 1 29 28 0.96 -0.23 0.21
## Education 1.48 1 5 4 -0.29 -0.56 0.03
## EducationField* 1.48 1 6 5 0.55 -0.69 0.03
## EmployeeCount 0.00 1 1 0 NaN NaN 0.00
## EmployeeNumber 790.97 1 2068 2067 0.02 -1.23 15.70
## EnvironmentSatisfaction 1.48 1 4 3 -0.32 -1.20 0.03
## Gender* 0.00 1 2 1 -0.41 -1.83 0.01
## HourlyRate 26.69 30 100 70 -0.03 -1.20 0.53
## JobInvolvement 0.00 1 4 3 -0.50 0.26 0.02
## JobLevel 1.48 1 5 4 1.02 0.39 0.03
## JobRole* 2.97 1 9 8 -0.36 -1.20 0.06
## JobSatisfaction 1.48 1 4 3 -0.33 -1.22 0.03
## MaritalStatus* 1.48 1 3 2 -0.15 -1.12 0.02
## MonthlyIncome 3260.24 1009 19999 18990 1.37 0.99 122.79
## MonthlyRate 9201.76 2094 26999 24905 0.02 -1.22 185.65
## NumCompaniesWorked 1.48 0 9 9 1.02 0.00 0.07
## Over18* 0.00 1 1 0 NaN NaN 0.00
## OverTime* 0.00 1 2 1 0.96 -1.07 0.01
## PercentSalaryHike 2.97 11 25 14 0.82 -0.31 0.10
## PerformanceRating 0.00 3 4 1 1.92 1.68 0.01
## RelationshipSatisfaction 1.48 1 4 3 -0.30 -1.19 0.03
## StandardHours 0.00 80 80 0 NaN NaN 0.00
## StockOptionLevel 1.48 0 3 3 0.97 0.35 0.02
## TotalWorkingYears 5.93 0 40 40 1.11 0.91 0.20
## TrainingTimesLastYear 1.48 0 6 6 0.55 0.48 0.03
## WorkLifeBalance 0.00 1 4 3 -0.55 0.41 0.02
## YearsAtCompany 4.45 0 40 40 1.76 3.91 0.16
## YearsInCurrentRole 4.45 0 18 18 0.92 0.47 0.09
## YearsSinceLastPromotion 1.48 0 15 15 1.98 3.59 0.08
## YearsWithCurrManager 4.45 0 17 17 0.83 0.16 0.09
## Attrition1 0.00 0 1 1 1.84 1.39 0.01
## BusinessTravel1 0.00 1 3 2 0.08 0.41 0.01
## Department1 0.00 1 3 2 0.17 -0.40 0.01
## EducationField1 1.48 1 6 5 0.55 -0.69 0.03
## Gender1 0.00 1 2 1 -0.41 -1.83 0.01
## JobRole1 2.97 1 9 8 -0.28 -1.32 0.06
## MaritalStatus1 1.48 1 3 2 -0.15 -1.12 0.02
## OverTime1 0.00 0 1 1 0.96 -1.07 0.01
mytable <-xtabs(~Attrition, data =Employeedata)
mytable
## Attrition
## No Yes
## 1233 237
mytable <-xtabs(~BusinessTravel, data =Employeedata)
mytable
## BusinessTravel
## Non-Travel Travel_Frequently Travel_Rarely
## 150 277 1043
mytable <-xtabs(~Department, data =Employeedata)
mytable
## Department
## Human Resources Research & Development Sales
## 63 961 446
mytable <-xtabs(~Education, data =Employeedata)
mytable
## Education
## 1 2 3 4 5
## 170 282 572 398 48
mytable <-xtabs(~EducationField, data =Employeedata)
mytable
## EducationField
## Human Resources Life Sciences Marketing Medical
## 27 606 159 464
## Other Technical Degree
## 82 132
mytable <-xtabs(~EnvironmentSatisfaction, data =Employeedata)
mytable
## EnvironmentSatisfaction
## 1 2 3 4
## 284 287 453 446
mytable <-xtabs(~Gender, data =Employeedata)
mytable
## Gender
## Female Male
## 588 882
mytable <-xtabs(~JobInvolvement, data =Employeedata)
mytable
## JobInvolvement
## 1 2 3 4
## 83 375 868 144
mytable <-xtabs(~JobLevel,data=Employeedata)
mytable
## JobLevel
## 1 2 3 4 5
## 543 534 218 106 69
mytable <-xtabs(~JobRole,data=Employeedata)
mytable
## JobRole
## Healthcare Representative Human Resources
## 131 52
## Laboratory Technician Manager
## 259 102
## Manufacturing Director Research Director
## 145 80
## Research Scientist Sales Executive
## 292 326
## Sales Representative
## 83
mytable <-xtabs(~JobSatisfaction,data=Employeedata)
mytable
## JobSatisfaction
## 1 2 3 4
## 289 280 442 459
mytable <-xtabs(~MaritalStatus,data=Employeedata)
mytable
## MaritalStatus
## Divorced Married Single
## 327 673 470
mytable <-xtabs(~Over18,data=Employeedata)
mytable
## Over18
## Y
## 1470
mytable <-xtabs(~OverTime,data=Employeedata)
mytable
## OverTime
## No Yes
## 1054 416
mytable <-xtabs(~PerformanceRating,data=Employeedata)
mytable
## PerformanceRating
## 3 4
## 1244 226
mytable <-xtabs(~RelationshipSatisfaction, data=Employeedata)
mytable
## RelationshipSatisfaction
## 1 2 3 4
## 276 303 459 432
mytable <-xtabs(~StandardHours, data=Employeedata)
mytable
## StandardHours
## 80
## 1470
mytable <-xtabs(~StockOptionLevel, data=Employeedata)
mytable
## StockOptionLevel
## 0 1 2 3
## 631 596 158 85
mytable <-xtabs(~WorkLifeBalance, data = Employeedata)
mytable
## WorkLifeBalance
## 1 2 3 4
## 80 344 893 153
mytable <-xtabs(~BusinessTravel + Attrition, data =Employeedata)
prop.table(mytable,1)
## Attrition
## BusinessTravel No Yes
## Non-Travel 0.9200000 0.0800000
## Travel_Frequently 0.7509025 0.2490975
## Travel_Rarely 0.8504314 0.1495686
mytable <-xtabs(~Department + Attrition, data =Employeedata)
prop.table(mytable,1)
## Attrition
## Department No Yes
## Human Resources 0.8095238 0.1904762
## Research & Development 0.8616025 0.1383975
## Sales 0.7937220 0.2062780
mytable <-xtabs(~Education + Attrition, data =Employeedata)
prop.table(mytable,1)
## Attrition
## Education No Yes
## 1 0.8176471 0.1823529
## 2 0.8439716 0.1560284
## 3 0.8269231 0.1730769
## 4 0.8542714 0.1457286
## 5 0.8958333 0.1041667
mytable <-xtabs(~EducationField + Attrition, data =Employeedata)
prop.table(mytable,1)
## Attrition
## EducationField No Yes
## Human Resources 0.7407407 0.2592593
## Life Sciences 0.8531353 0.1468647
## Marketing 0.7798742 0.2201258
## Medical 0.8642241 0.1357759
## Other 0.8658537 0.1341463
## Technical Degree 0.7575758 0.2424242
mytable <-xtabs(~EnvironmentSatisfaction + Attrition, data =Employeedata)
prop.table(mytable,1)
## Attrition
## EnvironmentSatisfaction No Yes
## 1 0.7464789 0.2535211
## 2 0.8501742 0.1498258
## 3 0.8631347 0.1368653
## 4 0.8654709 0.1345291
mytable <-xtabs(~Gender + Attrition, data =Employeedata)
prop.table(mytable,1)
## Attrition
## Gender No Yes
## Female 0.8520408 0.1479592
## Male 0.8299320 0.1700680
mytable <-xtabs(~JobInvolvement + Attrition, data =Employeedata)
prop.table(mytable,1)
## Attrition
## JobInvolvement No Yes
## 1 0.66265060 0.33734940
## 2 0.81066667 0.18933333
## 3 0.85599078 0.14400922
## 4 0.90972222 0.09027778
mytable <-xtabs(~JobLevel + Attrition, data =Employeedata)
prop.table(mytable,1)
## Attrition
## JobLevel No Yes
## 1 0.73664825 0.26335175
## 2 0.90262172 0.09737828
## 3 0.85321101 0.14678899
## 4 0.95283019 0.04716981
## 5 0.92753623 0.07246377
mytable <-xtabs(~JobRole + Attrition, data =Employeedata)
prop.table(mytable,1)
## Attrition
## JobRole No Yes
## Healthcare Representative 0.93129771 0.06870229
## Human Resources 0.76923077 0.23076923
## Laboratory Technician 0.76061776 0.23938224
## Manager 0.95098039 0.04901961
## Manufacturing Director 0.93103448 0.06896552
## Research Director 0.97500000 0.02500000
## Research Scientist 0.83904110 0.16095890
## Sales Executive 0.82515337 0.17484663
## Sales Representative 0.60240964 0.39759036
mytable <-xtabs(~JobSatisfaction + Attrition, data =Employeedata)
prop.table(mytable,1)
## Attrition
## JobSatisfaction No Yes
## 1 0.7716263 0.2283737
## 2 0.8357143 0.1642857
## 3 0.8348416 0.1651584
## 4 0.8867102 0.1132898
mytable <-xtabs(~MaritalStatus + Attrition, data =Employeedata)
prop.table(mytable,1)
## Attrition
## MaritalStatus No Yes
## Divorced 0.8990826 0.1009174
## Married 0.8751857 0.1248143
## Single 0.7446809 0.2553191
mytable <-xtabs(~OverTime + Attrition, data =Employeedata)
prop.table(mytable,1)
## Attrition
## OverTime No Yes
## No 0.8956357 0.1043643
## Yes 0.6947115 0.3052885
mytable <-xtabs(~PerformanceRating + Attrition, data =Employeedata)
prop.table(mytable,1)
## Attrition
## PerformanceRating No Yes
## 3 0.8392283 0.1607717
## 4 0.8362832 0.1637168
mytable <-xtabs(~RelationshipSatisfaction + Attrition, data =Employeedata)
prop.table(mytable,1)
## Attrition
## RelationshipSatisfaction No Yes
## 1 0.7934783 0.2065217
## 2 0.8514851 0.1485149
## 3 0.8453159 0.1546841
## 4 0.8518519 0.1481481
mytable <-xtabs(~StockOptionLevel + Attrition, data =Employeedata)
prop.table(mytable,1)
## Attrition
## StockOptionLevel No Yes
## 0 0.75594295 0.24405705
## 1 0.90604027 0.09395973
## 2 0.92405063 0.07594937
## 3 0.82352941 0.17647059
mytable <-xtabs(~WorkLifeBalance + Attrition, data =Employeedata)
prop.table(mytable,1)
## Attrition
## WorkLifeBalance No Yes
## 1 0.6875000 0.3125000
## 2 0.8313953 0.1686047
## 3 0.8577828 0.1422172
## 4 0.8235294 0.1764706
boxplot(Employeedata$ï..Age,main="Boxplot Showing Variation of Age")
mean(Employeedata$ï..Age)
## [1] 36.92381
boxplot(Employeedata$DailyRate,main="Boxplot Showing Variation of DailyRate")
mean(Employeedata$DailyRate)
## [1] 802.4857
boxplot(Employeedata$DistanceFromHome,ylim=c(-5,20),main="Boxplot Showing Variation of DistanceFromHome")
mean(Employeedata$DistanceFromHome)
## [1] 9.192517
boxplot(Employeedata$HourlyRate,main="Boxplot Showing Variation of HourlyRate")
mean(Employeedata$HourlyRate)
## [1] 65.89116
boxplot(Employeedata$MonthlyIncome,ylim=c(0,17000),main="Boxplot Showing Variation of MontlyIncome")
mean(Employeedata$MonthlyIncome)
## [1] 6502.931
boxplot(Employeedata$MonthlyRate,ylim=c(),main="Boxplot Showing Variation of MonthlyRate")
mean(Employeedata$MonthlyRate)
## [1] 14313.1
boxplot(Employeedata$NumCompaniesWorked,ylim=c(),main="Boxplot Showing Variation of Number of Companies Worked")
mean(Employeedata$NumCompaniesWorked)
## [1] 2.693197
boxplot(Employeedata$PercentSalaryHike,ylim=c(),main="Boxplot Showing Variation of Number of Companies Worked")
mean(Employeedata$PercentSalaryHike)
## [1] 15.20952
boxplot(Employeedata$TotalWorkingYears,ylim=c(),main="Boxplot Showing Variation of Total Working Years of Employee")
mean(Employeedata$TotalWorkingYears)
## [1] 11.27959
boxplot(Employeedata$TrainingTimesLastYear,ylim=c(),main="Boxplot Showing Variation of Training Time Last Year of Employee")
mean(Employeedata$TrainingTimesLastYear)
## [1] 2.79932
boxplot(Employeedata$YearsAtCompany,ylim=c(0,20),main="Boxplot Showing Variation of Years At Company for Employee")
mean(Employeedata$YearsAtCompany)
## [1] 7.008163
boxplot(Employeedata$YearsInCurrentRole,ylim=c(),main="Boxplot Showing Variation of Years In Current Role for Employee")
mean(Employeedata$YearsInCurrentRole)
## [1] 4.229252
boxplot(Employeedata$YearsSinceLastPromotion,ylim=c(),main="Boxplot Showing Variation of Years Since Last Promotion")
mean(Employeedata$YearsSinceLastPromotion)
## [1] 2.187755
boxplot(Employeedata$YearsWithCurrManager,ylim=c(),main="Boxplot Showing Variation of Years With Current Manager")
mean(Employeedata$YearsWithCurrManager)
## [1] 4.123129
plot(Employeedata$Attrition,xlim=c(),ylim=c(0,1500),ylab="Number Of Employee",main="Attrition Rate Counts")
plot(Employeedata$BusinessTravel,xlim=c(),ylim=c(),ylab="Count Of Employee",main="Variation Of Travel")
plot(Employeedata$Department,xlim=c(),ylim=c(),ylab="Count Of Employee",main="Variation Across Department")
hist(Employeedata$Education,col='grey')
plot(Employeedata$EducationField, ylab="Number OF Employees",main="Employees in Departments")
hist(Employeedata$EnvironmentSatisfaction,col='grey')
hist(Employeedata$HourlyRate,col='grey')
hist(Employeedata$JobInvolvement,col='grey')
hist(Employeedata$JobLevel,col='grey')
hist(Employeedata$JobSatisfaction,col='grey',main="Employee Satisfaction Variance")
hist(Employeedata$MonthlyIncome,breaks=20,col='grey',xlim=c(0,20000))
hist(Employeedata$MonthlyRate,col='grey',xlim=c(0,30000))
hist(Employeedata$NumCompaniesWorked,col='grey')
hist(Employeedata$PercentSalaryHike,col='grey')
hist(Employeedata$PerformanceRating,xlim=c(3,4),col='grey')
hist(Employeedata$RelationshipSatisfaction,col='grey')
hist(Employeedata$StockOptionLevel,col='grey')
hist(Employeedata$TotalWorkingYears,col='grey', main="Employee Working Years",breaks=25)
hist(Employeedata$TrainingTimesLastYear,col='grey', main="Employee's Training Time Last Year")
hist(Employeedata$WorkLifeBalance,col='grey', main="Employee's Work Life Balance Ratings")
hist(Employeedata$YearsAtCompany,col='grey', main="Employee's Years At Company")
hist(Employeedata$YearsInCurrentRole,col='grey',xlim=c(0,20),main="Employee's Years In Current Role")
hist(Employeedata$YearsSinceLastPromotion,xlim=c(0,18),ylim=c(0,1000),col='grey',main="Employee's Years Since Last Promotion")
hist(Employeedata$YearsWithCurrManager,col='grey',main="Employee's Years With current Managers")
cor(Num,use="complete")
## ï..Age DailyRate DistanceFromHome
## ï..Age 1.000000000 0.0106609426 -0.001686120
## DailyRate 0.010660943 1.0000000000 -0.004985337
## DistanceFromHome -0.001686120 -0.0049853374 1.000000000
## Education 0.208033731 -0.0168064332 0.021041826
## EnvironmentSatisfaction 0.010146428 0.0183548543 -0.016075327
## HourlyRate 0.024286543 0.0233814215 0.031130586
## JobInvolvement 0.029819959 0.0461348740 0.008783280
## JobLevel 0.509604228 0.0029663349 0.005302731
## JobSatisfaction -0.004891877 0.0305710078 -0.003668839
## MonthlyIncome 0.497854567 0.0077070589 -0.017014445
## MonthlyRate 0.028051167 -0.0321816015 0.027472864
## NumCompaniesWorked 0.299634758 0.0381534343 -0.029250804
## PercentSalaryHike 0.003633585 0.0227036775 0.040235377
## PerformanceRating 0.001903896 0.0004732963 0.027109618
## RelationshipSatisfaction 0.053534720 0.0078460310 0.006557475
## StockOptionLevel 0.037509712 0.0421427964 0.044871999
## TotalWorkingYears 0.680380536 0.0145147387 0.004628426
## TrainingTimesLastYear -0.019620819 0.0024525427 -0.036942234
## WorkLifeBalance -0.021490028 -0.0378480510 -0.026556004
## YearsAtCompany 0.311308770 -0.0340547676 0.009507720
## YearsInCurrentRole 0.212901056 0.0099320150 0.018844999
## YearsSinceLastPromotion 0.216513368 -0.0332289848 0.010028836
## YearsWithCurrManager 0.202088602 -0.0263631782 0.014406048
## Attrition1 -0.159205007 -0.0566519919 0.077923583
## BusinessTravel1 -0.011807332 -0.0155388905 -0.009696041
## Department1 -0.031882283 0.0071087137 0.017224804
## EducationField1 -0.040872848 0.0377092287 0.002013453
## Gender1 -0.036310550 -0.0117161379 -0.001850528
## JobRole1 -0.112807055 -0.0033580191 0.003574933
## MaritalStatus1 -0.095028910 -0.0695856414 -0.014437031
## OverTime1 0.028062357 0.0091349699 0.025513635
## Education EnvironmentSatisfaction
## ï..Age 0.208033731 0.0101464279
## DailyRate -0.016806433 0.0183548543
## DistanceFromHome 0.021041826 -0.0160753270
## Education 1.000000000 -0.0271283133
## EnvironmentSatisfaction -0.027128313 1.0000000000
## HourlyRate 0.016774829 -0.0498569562
## JobInvolvement 0.042437634 -0.0082775982
## JobLevel 0.101588886 0.0012116994
## JobSatisfaction -0.011296117 -0.0067843526
## MonthlyIncome 0.094960677 -0.0062590878
## MonthlyRate -0.026084197 0.0375996229
## NumCompaniesWorked 0.126316560 0.0125943232
## PercentSalaryHike -0.011110941 -0.0317011952
## PerformanceRating -0.024538791 -0.0295479523
## RelationshipSatisfaction -0.009118377 0.0076653835
## StockOptionLevel 0.018422220 0.0034321578
## TotalWorkingYears 0.148279697 -0.0026930704
## TrainingTimesLastYear -0.025100241 -0.0193593083
## WorkLifeBalance 0.009819189 0.0276272955
## YearsAtCompany 0.069113696 0.0014575492
## YearsInCurrentRole 0.060235554 0.0180074601
## YearsSinceLastPromotion 0.054254334 0.0161936056
## YearsWithCurrManager 0.069065378 -0.0049987226
## Attrition1 -0.031372820 -0.1033689783
## BusinessTravel1 -0.008669840 -0.0113099347
## Department1 0.007996422 -0.0193952706
## EducationField1 -0.039592150 0.0431634907
## Gender1 -0.016546827 0.0005083139
## JobRole1 0.007721031 -0.0145621843
## MaritalStatus1 0.004052654 -0.0035934733
## OverTime1 -0.020321767 0.0701317268
## HourlyRate JobInvolvement JobLevel
## ï..Age 0.0242865426 0.029819959 0.5096042284
## DailyRate 0.0233814215 0.046134874 0.0029663349
## DistanceFromHome 0.0311305856 0.008783280 0.0053027306
## Education 0.0167748289 0.042437634 0.1015888862
## EnvironmentSatisfaction -0.0498569562 -0.008277598 0.0012116994
## HourlyRate 1.0000000000 0.042860641 -0.0278534864
## JobInvolvement 0.0428606410 1.000000000 -0.0126298827
## JobLevel -0.0278534864 -0.012629883 1.0000000000
## JobSatisfaction -0.0713346244 -0.021475910 -0.0019437080
## MonthlyIncome -0.0157943044 -0.015271491 0.9502999135
## MonthlyRate -0.0152967496 -0.016322079 0.0395629510
## NumCompaniesWorked 0.0221568834 0.015012413 0.1425011238
## PercentSalaryHike -0.0090619863 -0.017204572 -0.0347304923
## PerformanceRating -0.0021716974 -0.029071333 -0.0212220821
## RelationshipSatisfaction 0.0013304528 0.034296821 0.0216415105
## StockOptionLevel 0.0502633991 0.021522640 0.0139839105
## TotalWorkingYears -0.0023336818 -0.005533182 0.7822078045
## TrainingTimesLastYear -0.0085476852 -0.015337826 -0.0181905502
## WorkLifeBalance -0.0046072338 -0.014616593 0.0378177456
## YearsAtCompany -0.0195816162 -0.021355427 0.5347386874
## YearsInCurrentRole -0.0241062202 0.008716963 0.3894467329
## YearsSinceLastPromotion -0.0267155861 -0.024184292 0.3538853470
## YearsWithCurrManager -0.0201232002 0.025975808 0.3752806078
## Attrition1 -0.0068455496 -0.130015957 -0.1691047509
## BusinessTravel1 -0.0041639831 0.029299959 -0.0116958303
## Department1 -0.0041437079 -0.024586062 0.1019631058
## EducationField1 -0.0219412191 -0.002655278 -0.0449326718
## Gender1 -0.0004782971 0.017959755 -0.0394031027
## JobRole1 -0.0165515330 0.007401840 -0.0668959855
## MaritalStatus1 -0.0178605059 -0.038497019 -0.0767694781
## OverTime1 -0.0077819744 -0.003506711 0.0005440478
## JobSatisfaction MonthlyIncome MonthlyRate
## ï..Age -0.0048918771 0.497854567 0.0280511671
## DailyRate 0.0305710078 0.007707059 -0.0321816015
## DistanceFromHome -0.0036688392 -0.017014445 0.0274728635
## Education -0.0112961167 0.094960677 -0.0260841972
## EnvironmentSatisfaction -0.0067843526 -0.006259088 0.0375996229
## HourlyRate -0.0713346244 -0.015794304 -0.0152967496
## JobInvolvement -0.0214759103 -0.015271491 -0.0163220791
## JobLevel -0.0019437080 0.950299913 0.0395629510
## JobSatisfaction 1.0000000000 -0.007156742 0.0006439169
## MonthlyIncome -0.0071567424 1.000000000 0.0348136261
## MonthlyRate 0.0006439169 0.034813626 1.0000000000
## NumCompaniesWorked -0.0556994260 0.149515216 0.0175213534
## PercentSalaryHike 0.0200020394 -0.027268586 -0.0064293459
## PerformanceRating 0.0022971971 -0.017120138 -0.0098114285
## RelationshipSatisfaction -0.0124535932 0.025873436 -0.0040853293
## StockOptionLevel 0.0106902261 0.005407677 -0.0343228302
## TotalWorkingYears -0.0201850727 0.772893246 0.0264424712
## TrainingTimesLastYear -0.0057793350 -0.021736277 0.0014668806
## WorkLifeBalance -0.0194587102 0.030683082 0.0079631575
## YearsAtCompany -0.0038026279 0.514284826 -0.0236551067
## YearsInCurrentRole -0.0023047852 0.363817667 -0.0128148744
## YearsSinceLastPromotion -0.0182135678 0.344977638 0.0015667995
## YearsWithCurrManager -0.0276562139 0.344078883 -0.0367459053
## Attrition1 -0.1034811261 -0.159839582 0.0151702125
## BusinessTravel1 0.0086659585 -0.013449947 -0.0084404916
## Department1 0.0210008789 0.053129698 0.0236420721
## EducationField1 -0.0344008137 -0.041070150 -0.0271816823
## Gender1 0.0332516974 -0.031858492 -0.0414822051
## JobRole1 0.0224686645 -0.082090118 0.0080868505
## MaritalStatus1 0.0243599530 -0.075449582 0.0239374266
## OverTime1 0.0245394811 0.006089285 0.0214311446
## NumCompaniesWorked PercentSalaryHike
## ï..Age 0.299634758 0.003633585
## DailyRate 0.038153434 0.022703677
## DistanceFromHome -0.029250804 0.040235377
## Education 0.126316560 -0.011110941
## EnvironmentSatisfaction 0.012594323 -0.031701195
## HourlyRate 0.022156883 -0.009061986
## JobInvolvement 0.015012413 -0.017204572
## JobLevel 0.142501124 -0.034730492
## JobSatisfaction -0.055699426 0.020002039
## MonthlyIncome 0.149515216 -0.027268586
## MonthlyRate 0.017521353 -0.006429346
## NumCompaniesWorked 1.000000000 -0.010238309
## PercentSalaryHike -0.010238309 1.000000000
## PerformanceRating -0.014094873 0.773549996
## RelationshipSatisfaction 0.052733049 -0.040490081
## StockOptionLevel 0.030075475 0.007527748
## TotalWorkingYears 0.237638590 -0.020608488
## TrainingTimesLastYear -0.066054072 -0.005221012
## WorkLifeBalance -0.008365685 -0.003279636
## YearsAtCompany -0.118421340 -0.035991262
## YearsInCurrentRole -0.090753934 -0.001520027
## YearsSinceLastPromotion -0.036813892 -0.022154313
## YearsWithCurrManager -0.110319155 -0.011985248
## Attrition1 0.043493739 -0.013478202
## BusinessTravel1 -0.030742984 -0.025726943
## Department1 -0.035881612 -0.007840161
## EducationField1 -0.008663043 -0.011213502
## Gender1 -0.039147450 0.002732648
## JobRole1 -0.056838388 0.003231282
## MaritalStatus1 -0.035505389 0.012492329
## OverTime1 -0.020785821 -0.005432827
## PerformanceRating RelationshipSatisfaction
## ï..Age 0.0019038955 0.0535347197
## DailyRate 0.0004732963 0.0078460310
## DistanceFromHome 0.0271096185 0.0065574746
## Education -0.0245387912 -0.0091183767
## EnvironmentSatisfaction -0.0295479523 0.0076653835
## HourlyRate -0.0021716974 0.0013304528
## JobInvolvement -0.0290713334 0.0342968206
## JobLevel -0.0212220821 0.0216415105
## JobSatisfaction 0.0022971971 -0.0124535932
## MonthlyIncome -0.0171201382 0.0258734361
## MonthlyRate -0.0098114285 -0.0040853293
## NumCompaniesWorked -0.0140948728 0.0527330486
## PercentSalaryHike 0.7735499964 -0.0404900811
## PerformanceRating 1.0000000000 -0.0313514554
## RelationshipSatisfaction -0.0313514554 1.0000000000
## StockOptionLevel 0.0035064716 -0.0459524907
## TotalWorkingYears 0.0067436679 0.0240542918
## TrainingTimesLastYear -0.0155788817 0.0024965264
## WorkLifeBalance 0.0025723613 0.0196044057
## YearsAtCompany 0.0034351261 0.0193667869
## YearsInCurrentRole 0.0349862604 -0.0151229149
## YearsSinceLastPromotion 0.0178960661 0.0334925021
## YearsWithCurrManager 0.0228271689 -0.0008674968
## Attrition1 0.0028887517 -0.0458722789
## BusinessTravel1 0.0016833372 0.0089263034
## Department1 -0.0246035428 -0.0224144254
## EducationField1 -0.0056142134 -0.0043777110
## Gender1 -0.0138590184 0.0228683700
## JobRole1 -0.0244593806 -0.0250233999
## MaritalStatus1 0.0052066260 0.0225490707
## OverTime1 0.0043691201 0.0484928029
## StockOptionLevel TotalWorkingYears
## ï..Age 0.0375097124 0.680380536
## DailyRate 0.0421427964 0.014514739
## DistanceFromHome 0.0448719989 0.004628426
## Education 0.0184222202 0.148279697
## EnvironmentSatisfaction 0.0034321578 -0.002693070
## HourlyRate 0.0502633991 -0.002333682
## JobInvolvement 0.0215226404 -0.005533182
## JobLevel 0.0139839105 0.782207805
## JobSatisfaction 0.0106902261 -0.020185073
## MonthlyIncome 0.0054076767 0.772893246
## MonthlyRate -0.0343228302 0.026442471
## NumCompaniesWorked 0.0300754751 0.237638590
## PercentSalaryHike 0.0075277478 -0.020608488
## PerformanceRating 0.0035064716 0.006743668
## RelationshipSatisfaction -0.0459524907 0.024054292
## StockOptionLevel 1.0000000000 0.010135969
## TotalWorkingYears 0.0101359693 1.000000000
## TrainingTimesLastYear 0.0112740696 -0.035661571
## WorkLifeBalance 0.0041287300 0.001007646
## YearsAtCompany 0.0150580080 0.628133155
## YearsInCurrentRole 0.0508178728 0.460364638
## YearsSinceLastPromotion 0.0143521849 0.404857759
## YearsWithCurrManager 0.0246982266 0.459188397
## Attrition1 -0.1371449189 -0.171063246
## BusinessTravel1 -0.0282569533 0.007972110
## Department1 -0.0121929144 -0.015761512
## EducationField1 -0.0161847132 -0.027847626
## Gender1 0.0127157138 -0.046880939
## JobRole1 -0.0174347521 -0.131447230
## MaritalStatus1 -0.6625772917 -0.077886352
## OverTime1 -0.0004486707 0.012754266
## TrainingTimesLastYear WorkLifeBalance
## ï..Age -0.019620819 -0.021490028
## DailyRate 0.002452543 -0.037848051
## DistanceFromHome -0.036942234 -0.026556004
## Education -0.025100241 0.009819189
## EnvironmentSatisfaction -0.019359308 0.027627295
## HourlyRate -0.008547685 -0.004607234
## JobInvolvement -0.015337826 -0.014616593
## JobLevel -0.018190550 0.037817746
## JobSatisfaction -0.005779335 -0.019458710
## MonthlyIncome -0.021736277 0.030683082
## MonthlyRate 0.001466881 0.007963158
## NumCompaniesWorked -0.066054072 -0.008365685
## PercentSalaryHike -0.005221012 -0.003279636
## PerformanceRating -0.015578882 0.002572361
## RelationshipSatisfaction 0.002496526 0.019604406
## StockOptionLevel 0.011274070 0.004128730
## TotalWorkingYears -0.035661571 0.001007646
## TrainingTimesLastYear 1.000000000 0.028072207
## WorkLifeBalance 0.028072207 1.000000000
## YearsAtCompany 0.003568666 0.012089185
## YearsInCurrentRole -0.005737504 0.049856498
## YearsSinceLastPromotion -0.002066536 0.008941249
## YearsWithCurrManager -0.004095526 0.002759440
## Attrition1 -0.059477799 -0.063939047
## BusinessTravel1 0.016357219 0.004208799
## Department1 0.036875066 0.026382525
## EducationField1 0.049195353 0.041191131
## Gender1 -0.038786735 -0.002752679
## JobRole1 0.002694826 0.022249350
## MaritalStatus1 0.010628607 0.014708294
## OverTime1 -0.079113372 -0.027091878
## YearsAtCompany YearsInCurrentRole
## ï..Age 0.311308770 0.212901056
## DailyRate -0.034054768 0.009932015
## DistanceFromHome 0.009507720 0.018844999
## Education 0.069113696 0.060235554
## EnvironmentSatisfaction 0.001457549 0.018007460
## HourlyRate -0.019581616 -0.024106220
## JobInvolvement -0.021355427 0.008716963
## JobLevel 0.534738687 0.389446733
## JobSatisfaction -0.003802628 -0.002304785
## MonthlyIncome 0.514284826 0.363817667
## MonthlyRate -0.023655107 -0.012814874
## NumCompaniesWorked -0.118421340 -0.090753934
## PercentSalaryHike -0.035991262 -0.001520027
## PerformanceRating 0.003435126 0.034986260
## RelationshipSatisfaction 0.019366787 -0.015122915
## StockOptionLevel 0.015058008 0.050817873
## TotalWorkingYears 0.628133155 0.460364638
## TrainingTimesLastYear 0.003568666 -0.005737504
## WorkLifeBalance 0.012089185 0.049856498
## YearsAtCompany 1.000000000 0.758753737
## YearsInCurrentRole 0.758753737 1.000000000
## YearsSinceLastPromotion 0.618408865 0.548056248
## YearsWithCurrManager 0.769212425 0.714364762
## Attrition1 -0.134392214 -0.160545004
## BusinessTravel1 0.005212128 -0.005336424
## Department1 0.022920442 0.056315447
## EducationField1 -0.018692101 -0.010506203
## Gender1 -0.029747086 -0.041482729
## JobRole1 -0.074311010 -0.018338077
## MaritalStatus1 -0.059986004 -0.065821900
## OverTime1 -0.011687120 -0.029758009
## YearsSinceLastPromotion YearsWithCurrManager
## ï..Age 0.216513368 0.2020886024
## DailyRate -0.033228985 -0.0263631782
## DistanceFromHome 0.010028836 0.0144060484
## Education 0.054254334 0.0690653783
## EnvironmentSatisfaction 0.016193606 -0.0049987226
## HourlyRate -0.026715586 -0.0201232002
## JobInvolvement -0.024184292 0.0259758079
## JobLevel 0.353885347 0.3752806078
## JobSatisfaction -0.018213568 -0.0276562139
## MonthlyIncome 0.344977638 0.3440788833
## MonthlyRate 0.001566800 -0.0367459053
## NumCompaniesWorked -0.036813892 -0.1103191554
## PercentSalaryHike -0.022154313 -0.0119852485
## PerformanceRating 0.017896066 0.0228271689
## RelationshipSatisfaction 0.033492502 -0.0008674968
## StockOptionLevel 0.014352185 0.0246982266
## TotalWorkingYears 0.404857759 0.4591883971
## TrainingTimesLastYear -0.002066536 -0.0040955260
## WorkLifeBalance 0.008941249 0.0027594402
## YearsAtCompany 0.618408865 0.7692124251
## YearsInCurrentRole 0.548056248 0.7143647616
## YearsSinceLastPromotion 1.000000000 0.5102236358
## YearsWithCurrManager 0.510223636 1.0000000000
## Attrition1 -0.033018775 -0.1561993159
## BusinessTravel1 0.005222020 -0.0002285118
## Department1 0.040060967 0.0342824726
## EducationField1 0.002325656 -0.0041296947
## Gender1 -0.026984577 -0.0305989093
## JobRole1 -0.034749921 -0.0339826983
## MaritalStatus1 -0.030915079 -0.0385700737
## OverTime1 -0.012238823 -0.0415859987
## Attrition1 BusinessTravel1 Department1
## ï..Age -0.159205007 -0.0118073324 -0.031882283
## DailyRate -0.056651992 -0.0155388905 0.007108714
## DistanceFromHome 0.077923583 -0.0096960412 0.017224804
## Education -0.031372820 -0.0086698401 0.007996422
## EnvironmentSatisfaction -0.103368978 -0.0113099347 -0.019395271
## HourlyRate -0.006845550 -0.0041639831 -0.004143708
## JobInvolvement -0.130015957 0.0292999586 -0.024586062
## JobLevel -0.169104751 -0.0116958303 0.101963106
## JobSatisfaction -0.103481126 0.0086659585 0.021000879
## MonthlyIncome -0.159839582 -0.0134499467 0.053129698
## MonthlyRate 0.015170213 -0.0084404916 0.023642072
## NumCompaniesWorked 0.043493739 -0.0307429842 -0.035881612
## PercentSalaryHike -0.013478202 -0.0257269434 -0.007840161
## PerformanceRating 0.002888752 0.0016833372 -0.024603543
## RelationshipSatisfaction -0.045872279 0.0089263034 -0.022414425
## StockOptionLevel -0.137144919 -0.0282569533 -0.012192914
## TotalWorkingYears -0.171063246 0.0079721100 -0.015761512
## TrainingTimesLastYear -0.059477799 0.0163572195 0.036875066
## WorkLifeBalance -0.063939047 0.0042087993 0.026382525
## YearsAtCompany -0.134392214 0.0052121277 0.022920442
## YearsInCurrentRole -0.160545004 -0.0053364236 0.056315447
## YearsSinceLastPromotion -0.033018775 0.0052220205 0.040060967
## YearsWithCurrManager -0.156199316 -0.0002285118 0.034282473
## Attrition1 1.000000000 0.1270064832 0.063990596
## BusinessTravel1 0.127006483 1.0000000000 -0.002639604
## Department1 0.063990596 -0.0026396043 1.000000000
## EducationField1 0.026845546 -0.0234890783 0.013719502
## Gender1 0.029453253 -0.0448955126 -0.041583290
## JobRole1 0.057389161 0.0112895901 0.704252821
## MaritalStatus1 0.162070235 0.0309149876 0.056073435
## OverTime1 0.246117994 0.0427515162 0.007480968
## EducationField1 Gender1 JobRole1
## ï..Age -0.040872848 -0.0363105501 -0.112807055
## DailyRate 0.037709229 -0.0117161379 -0.003358019
## DistanceFromHome 0.002013453 -0.0018505280 0.003574933
## Education -0.039592150 -0.0165468274 0.007721031
## EnvironmentSatisfaction 0.043163491 0.0005083139 -0.014562184
## HourlyRate -0.021941219 -0.0004782971 -0.016551533
## JobInvolvement -0.002655278 0.0179597554 0.007401840
## JobLevel -0.044932672 -0.0394031027 -0.066895985
## JobSatisfaction -0.034400814 0.0332516974 0.022468664
## MonthlyIncome -0.041070150 -0.0318584918 -0.082090118
## MonthlyRate -0.027181682 -0.0414822051 0.008086851
## NumCompaniesWorked -0.008663043 -0.0391474496 -0.056838388
## PercentSalaryHike -0.011213502 0.0027326475 0.003231282
## PerformanceRating -0.005614213 -0.0138590184 -0.024459381
## RelationshipSatisfaction -0.004377711 0.0228683700 -0.025023400
## StockOptionLevel -0.016184713 0.0127157138 -0.017434752
## TotalWorkingYears -0.027847626 -0.0468809395 -0.131447230
## TrainingTimesLastYear 0.049195353 -0.0387867355 0.002694826
## WorkLifeBalance 0.041191131 -0.0027526788 0.022249350
## YearsAtCompany -0.018692101 -0.0297470859 -0.074311010
## YearsInCurrentRole -0.010506203 -0.0414827285 -0.018338077
## YearsSinceLastPromotion 0.002325656 -0.0269845772 -0.034749921
## YearsWithCurrManager -0.004129695 -0.0305989093 -0.033982698
## Attrition1 0.026845546 0.0294532532 0.057389161
## BusinessTravel1 -0.023489078 -0.0448955126 0.011289590
## Department1 0.013719502 -0.0415832902 0.704252821
## EducationField1 1.000000000 -0.0025040188 0.027910348
## Gender1 -0.002504019 1.0000000000 -0.043196964
## JobRole1 0.027910348 -0.0431969638 1.000000000
## MaritalStatus1 0.014419541 -0.0471825924 0.069833317
## OverTime1 0.002258600 -0.0419243480 0.043227665
## MaritalStatus1 OverTime1
## ï..Age -0.095028910 0.0280623571
## DailyRate -0.069585641 0.0091349699
## DistanceFromHome -0.014437031 0.0255136349
## Education 0.004052654 -0.0203217674
## EnvironmentSatisfaction -0.003593473 0.0701317268
## HourlyRate -0.017860506 -0.0077819744
## JobInvolvement -0.038497019 -0.0035067106
## JobLevel -0.076769478 0.0005440478
## JobSatisfaction 0.024359953 0.0245394811
## MonthlyIncome -0.075449582 0.0060892854
## MonthlyRate 0.023937427 0.0214311446
## NumCompaniesWorked -0.035505389 -0.0207858214
## PercentSalaryHike 0.012492329 -0.0054328267
## PerformanceRating 0.005206626 0.0043691201
## RelationshipSatisfaction 0.022549071 0.0484928029
## StockOptionLevel -0.662577292 -0.0004486707
## TotalWorkingYears -0.077886352 0.0127542663
## TrainingTimesLastYear 0.010628607 -0.0791133716
## WorkLifeBalance 0.014708294 -0.0270918785
## YearsAtCompany -0.059986004 -0.0116871205
## YearsInCurrentRole -0.065821900 -0.0297580089
## YearsSinceLastPromotion -0.030915079 -0.0122388226
## YearsWithCurrManager -0.038570074 -0.0415859987
## Attrition1 0.162070235 0.2461179942
## BusinessTravel1 0.030914988 0.0427515162
## Department1 0.056073435 0.0074809676
## EducationField1 0.014419541 0.0022585999
## Gender1 -0.047182592 -0.0419243480
## JobRole1 0.069833317 0.0432276651
## MaritalStatus1 1.000000000 -0.0175213816
## OverTime1 -0.017521382 1.0000000000
library("corrgram", lib.loc="~/R/win-library/3.4")
corrgram(Num,lower.panel=panel.shade,upper.panel=panel.pie,order=TRUE)
cor.test (Num[,"Attrition1"], Num[,"BusinessTravel1"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "BusinessTravel1"]
## t = 4.9059, df = 1468, p-value = 1.033e-06
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.07637497 0.17698469
## sample estimates:
## cor
## 0.1270065
cor.test (Num[,"Attrition1"], Num[,"DailyRate"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "DailyRate"]
## t = -2.1741, df = 1468, p-value = 0.02986
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.107468170 -0.005540584
## sample estimates:
## cor
## -0.05665199
cor.test (Num[,"Attrition1"], Num[,"DistanceFromHome"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "DistanceFromHome"]
## t = 2.9947, df = 1468, p-value = 0.002793
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.02690331 0.12853894
## sample estimates:
## cor
## 0.07792358
cor.test (Num[,"Attrition1"], Num[,"Education"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "Education"]
## t = -1.2026, df = 1468, p-value = 0.2293
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.08236816 0.01978637
## sample estimates:
## cor
## -0.03137282
cor.test (Num[,"Attrition1"], Num[,"EnvironmentSatisfaction"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "EnvironmentSatisfaction"]
## t = -3.9819, df = 1468, p-value = 7.172e-05
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.15368421 -0.05251908
## sample estimates:
## cor
## -0.103369
cor.test (Num[,"Attrition1"], Num[,"Gender1"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "Gender1"]
## t = 1.129, df = 1468, p-value = 0.2591
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.02170689 0.08045955
## sample estimates:
## cor
## 0.02945325
cor.test (Num[,"Attrition1"], Num[,"HourlyRate"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "HourlyRate"]
## t = -0.26229, df = 1468, p-value = 0.7931
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.05795272 0.04429741
## sample estimates:
## cor
## -0.00684555
cor.test (Num[,"Attrition1"], Num[,"JobInvolvement"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "JobInvolvement"]
## t = -5.0241, df = 1468, p-value = 5.677e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.17994723 -0.07941641
## sample estimates:
## cor
## -0.130016
cor.test (Num[,"Attrition1"], Num[,"JobLevel"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "JobLevel"]
## t = -6.5738, df = 1468, p-value = 6.795e-11
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.2183444 -0.1190062
## sample estimates:
## cor
## -0.1691048
cor.test (Num[,"Attrition1"], Num[,"JobSatisfaction"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "JobSatisfaction"]
## t = -3.9862, df = 1468, p-value = 7.043e-05
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.15379490 -0.05263213
## sample estimates:
## cor
## -0.1034811
cor.test (Num[,"Attrition1"], Num[,"MaritalStatus1"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "MaritalStatus1"]
## t = 6.2928, df = 1468, p-value = 4.106e-10
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.1118698 0.2114456
## sample estimates:
## cor
## 0.1620702
cor.test (Num[,"Attrition1"], Num[,"MonthlyIncome"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "MonthlyIncome"]
## t = -6.2039, df = 1468, p-value = 7.147e-10
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.2092570 -0.1096079
## sample estimates:
## cor
## -0.1598396
cor.test (Num[,"Attrition1"], Num[,"MonthlyRate"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "MonthlyRate"]
## t = 0.58131, df = 1468, p-value = 0.5611
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.03598515 0.06624629
## sample estimates:
## cor
## 0.01517021
cor.test (Num[,"Attrition1"], Num[,"NumCompaniesWorked"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "NumCompaniesWorked"]
## t = 1.668, df = 1468, p-value = 0.09553
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.00765073 0.09441125
## sample estimates:
## cor
## 0.04349374
cor.test (Num[,"Attrition1"], Num[,"OverTime1"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "OverTime1"]
## t = 9.7292, df = 1468, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.1974754 0.2935516
## sample estimates:
## cor
## 0.246118
cor.test (Num[,"Attrition1"], Num[,"PercentSalaryHike"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "PercentSalaryHike"]
## t = -0.51646, df = 1468, p-value = 0.6056
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.06456117 0.03767522
## sample estimates:
## cor
## -0.0134782
cor.test (Num[,"Attrition1"], Num[,"PerformanceRating"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "PerformanceRating"]
## t = 0.11068, df = 1468, p-value = 0.9119
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.04824583 0.05400823
## sample estimates:
## cor
## 0.002888752
cor.test (Num[,"Attrition1"], Num[,"RelationshipSatisfaction"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "RelationshipSatisfaction"]
## t = -1.7594, df = 1468, p-value = 0.07871
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.096772771 0.005267532
## sample estimates:
## cor
## -0.04587228
cor.test (Num[,"Attrition1"], Num[,"StockOptionLevel"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "StockOptionLevel"]
## t = -5.3048, df = 1468, p-value = 1.301e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.18696143 -0.08662486
## sample estimates:
## cor
## -0.1371449
cor.test (Num[,"Attrition1"], Num[,"TotalWorkingYears"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "TotalWorkingYears"]
## t = -6.6523, df = 1468, p-value = 4.062e-11
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.2202643 -0.1209940
## sample estimates:
## cor
## -0.1710632
cor.test (Num[,"Attrition1"], Num[,"WorkLifeBalance"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "WorkLifeBalance"]
## t = -2.4548, df = 1468, p-value = 0.01421
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.11469157 -0.01285361
## sample estimates:
## cor
## -0.06393905
cor.test (Num[,"Attrition1"], Num[,"YearsAtCompany"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "YearsAtCompany"]
## t = -5.1963, df = 1468, p-value = 2.319e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.18425364 -0.08384084
## sample estimates:
## cor
## -0.1343922
cor.test (Num[,"Attrition1"], Num[,"YearsInCurrentRole"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "YearsInCurrentRole"]
## t = -6.232, df = 1468, p-value = 6.003e-10
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.2099491 -0.1103231
## sample estimates:
## cor
## -0.160545
cor.test (Num[,"Attrition1"], Num[,"YearsSinceLastPromotion"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "YearsSinceLastPromotion"]
## t = -1.2658, df = 1468, p-value = 0.2058
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.08400442 0.01813930
## sample estimates:
## cor
## -0.03301878
cor.test (Num[,"Attrition1"], Num[,"YearsWithCurrManager"])
##
## Pearson's product-moment correlation
##
## data: Num[, "Attrition1"] and Num[, "YearsWithCurrManager"]
## t = -6.0591, df = 1468, p-value = 1.737e-09
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.2056842 -0.1059177
## sample estimates:
## cor
## -0.1561993