hr1 <- hr %>%
  mutate(Employee_Status = ifelse(left == 0 , 'Stayed' , 'Left'))

Average Monthly Hours vs. Employee Status

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

p-value: The difference between the means of monthly hours of employees that stayed and left is significant.

t-test interpretation: Employees that left, on average, work more hours, about 26 more hours.

non-technical interpretation: Employees that left tended to work more hours than those who stayed.

plot_ly(hr1 , 
        x = ~Employee_Status , 
        y = ~ average_montly_hours , 
        type = 'box' ,
        color = ~Employee_Status ,
        colors = c('#d2abe9' , 'pink')
        ) %>%
  layout(title = 'Employees that left, on average, 
         work more hours, about 26 more hours')

Satisfaction Level vs. Employee Status

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

p-value: The difference between the means of satisfaction level and employee status is significant.

t-test interpretation: Employees that left, on average, had a lower satisfcation level, about 0.28 lower.

non-technical interpretation: Employees that left, on average, were less satisfied with their job compared to those who stayed.

plot_ly(hr1 , 
        x = ~Employee_Status , 
        y = ~satisfaction_level , 
        type = 'box' ,
        color = ~Employee_Status ,
        colors = c('#a8e5aa' , '#a3b0db')
        ) %>%
  layout(title = 'Employees that left, on average, had a 
              lower satisfcation level, about 0.28 lower')

Number of Projects vs. Employee Status

t.test(hr1$number_project ~ hr1$Employee_Status)
## 
##  Welch Two Sample t-test
## 
## data:  hr1$number_project by hr1$Employee_Status
## t = 2.1663, df = 4236.5, p-value = 0.03034
## alternative hypothesis: true difference in means between group Left and group Stayed is not equal to 0
## 95 percent confidence interval:
##  0.006540119 0.131136535
## sample estimates:
##   mean in group Left mean in group Stayed 
##             3.855503             3.786664

p-value: Since the number of observations is >150, the significance level would be 0.01 instead of 0.05 and therefore, the means of the number of projects and employee status is not significant.

t-test interpretation: Employees that left, on average, have about the same number of projects for each employee status, although there is a larger spread of data based on people that left.

non-technical interpretation: Employees that left or stayed had about the same number of projects but for those who left, the number of projects varied more.

plot_ly(hr1 , 
        x = ~Employee_Status , 
        y = ~number_project , 
        type = 'box' ,
        color = ~Employee_Status ,
        colors = c('#dba3ad' , '#e5b45b')
        ) %>%
  layout(title = 'Employees that left, on average, have about 
            the same number of projects for each employee status, 
         although there is a larger spread of data based on people that left.')

Time Spent at the Company vs. Employee Status

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

p-value: The difference between means of the time spent at the company and the employee status is significant.

t-test interpretation: Employees that left, on average, had been at the company longer, by about 1 year.

non-technical interpretation: Employees who left had been with the company about 1 year longer than those who stayed.

plot_ly(hr1 , 
        x = ~Employee_Status , 
        y = ~time_spend_company , 
        type = 'box' ,
        color = ~Employee_Status ,
        colors = c('#87ddcb' , '#d19ee4')
        ) %>%
  layout(title = 'Employees that left, on average, had been 
                 at the company longer, by about 1 year.')