1. Average Monthly Hours
hr1 <- hr%>%
mutate(Employee_Status = as.factor(ifelse(left == 0 , 'stayed' , 'left')))
t.test(hr1$average_montly_hours ~ hr1$Employee_Status)
##
## Welch Two Sample t-test
##
## data: hr1$average_montly_hours by hr1$Employee_Status
## t = 7.5323, df = 4875.1, p-value = 5.907e-14
## alternative hypothesis: true difference in means between group left and group stayed is not equal to 0
## 95 percent confidence interval:
## 6.183384 10.534631
## sample estimates:
## mean in group left mean in group stayed
## 207.4192 199.0602
There is a significant difference between means, where employees
that left work at least 6 hours more.
To reduce employee attrition, average monthly hours can be reduced
by 3% for those that work longer hours
plot_ly(hr1,
x = ~Employee_Status ,
y = ~average_montly_hours ,
type = 'box' ,
color = ~Employee_Status ,
colors = c('#e62fa5' , '#901535')) %>%
layout(title = 'employees that left, on average, work more hours, at least 3% more' ,
xaxis = list(title = 'Employee Status') ,
yaxis = list(title = 'Avg. Monthly Hours'))
2. Time Spent Company
t.test(hr1$time_spend_company ~ hr1$Employee_Status)
##
## Welch Two Sample t-test
##
## data: hr1$time_spend_company by hr1$Employee_Status
## t = 22.631, df = 9625.6, p-value < 2.2e-16
## alternative hypothesis: true difference in means between group left and group stayed is not equal to 0
## 95 percent confidence interval:
## 0.4534706 0.5394767
## sample estimates:
## mean in group left mean in group stayed
## 3.876505 3.380032
There is a significant difference between means, where employees
that left Have spent more time at the company.
Employees that have been with the comnpany longer, are more likely
to leave
plot_ly(hr1,
x = ~Employee_Status ,
y = ~time_spend_company ,
type = 'box' ,
color = ~Employee_Status ,
colors = c('#e62fa5' , '#901535')) %>%
layout(title = 'employees that have been with the company longer, are more likely to leave' ,
xaxis = list(title = 'Employee Status') ,
yaxis = list(title = 'Time Spent Company'))
3. Satisfaction Level
t.test(hr1$satisfaction_level ~ hr1$Employee_Status)
##
## Welch Two Sample t-test
##
## data: hr1$satisfaction_level by hr1$Employee_Status
## t = -46.636, df = 5167, p-value < 2.2e-16
## alternative hypothesis: true difference in means between group left and group stayed is not equal to 0
## 95 percent confidence interval:
## -0.2362417 -0.2171815
## sample estimates:
## mean in group left mean in group stayed
## 0.4400980 0.6668096
There is a significant difference between means, where employees
that left have a lower satisfaction.
Employees that leave, tend to have a lower satisfaction level.
plot_ly(hr1,
x = ~Employee_Status ,
y = ~satisfaction_level ,
type = 'box' ,
color = ~Employee_Status ,
colors = c('#e62fa5' , '#901535')) %>%
layout(title = 'employees that leave, tend to have a lower satisfaction level' ,
xaxis = list(title = 'Employee Status') ,
yaxis = list(title = 'Satisfaction Level'))
4. Last Evaluation
t.test(hr1$last_evaluation ~ hr1$Employee_Status)
##
## Welch Two Sample t-test
##
## data: hr1$last_evaluation by hr1$Employee_Status
## t = 0.72534, df = 5154.9, p-value = 0.4683
## alternative hypothesis: true difference in means between group left and group stayed is not equal to 0
## 95 percent confidence interval:
## -0.004493874 0.009772224
## sample estimates:
## mean in group left mean in group stayed
## 0.7181126 0.7154734
There is a slight difference between means, where employees that
left have been evaluated more.
Employees that leave, tend to be evaluated more.
plot_ly(hr1,
x = ~Employee_Status ,
y = ~last_evaluation ,
type = 'box' ,
color = ~Employee_Status ,
colors = c('#e62fa5' , '#901535')) %>%
layout(title = 'employees that leave, tend to be evaluated more' ,
xaxis = list(title = 'Employee Status') ,
yaxis = list(title = 'Last Evaluation'))