Test 1 - Promotion by Left

Chi-square Test

chisq.test(hr$satisfaction_level, hr$left)
## 
##  Pearson's Chi-squared test
## 
## data:  hr$satisfaction_level and hr$left
## X-squared = 7937.7, df = 91, p-value < 2.2e-16

Technical Interpretation

Since the p-value is <0.01, then we reject the Null hypothesis and can state ### that there is a difference in leaving based off of whether or not you have been promoted. The X2 being at 56.3% means that it is more liekly for a significant relationship.

Non-Technical Interpretation

Employees that have not been promoted within the last 5 years

leave the company more often

Plot

ggplot(hr, aes(x = as.factor(promotion_last_5years), fill = as.factor(left))) +
  geom_bar(position = "fill") +
  labs(
    title = "Employees Not Promoted Within the Last 5 Years \n Leave More Frequently", 
    x = "Promotion in Last 5 Years (0= No, 1 = Yes)",
    y= "Proportion",
    fill = "left"
  ) +
  theme_minimal()

Test 2- Department by Left

Chi-square test

chisq.test(hr$Department, hr$left)
## 
##  Pearson's Chi-squared test
## 
## data:  hr$Department and hr$left
## X-squared = 86.825, df = 9, p-value = 7.042e-15

Technical Interpretation

Since the p-value is <0.01, then we reject the Null hypothesis and can state

that there is a difference in leaving based off what department you work in.

The x2 of 86.825 indicates that it is more likely for a significant relationship.

Non-technical Interpretation

Depanding on what department you work in there is a higher or lower chance of you staying or leaving.

Hr leaves the most, Management leaves the least.

Plot

ggplot(hr, aes(x = as.factor(Department), fill = as.factor(left))) +
  geom_bar(position = "fill") +
  labs( 
    Title = "HR leaves the most, Management leaves the least", 
    x= "Department", 
    y = "Proportion", 
    fill = "left") +
  theme_minimal()

Test 3- Salary by Left

Chi-square test

chisq.test(hr$salary, hr$left)
## 
##  Pearson's Chi-squared test
## 
## data:  hr$salary and hr$left
## X-squared = 381.23, df = 2, p-value < 2.2e-16

Technical Interpretation

Since the p-value is <0.01, then we reject the Null hypothesis and can state

that there is a difference in leaving and your Salary.

The x2 of 381.23 indicates that there is strong difference.

Non-technical Interpretation

The higher salary the lower chance that you will leave

Plot

ggplot(hr, aes(x = as.factor(salary), fill = as.factor(left))) +
  geom_bar(position = "fill") +
  labs( 
    Title = "The Higher the Salary, the less Likely you are to Leave", 
    x= "Salary", 
    y = "Proportion", 
    fill = "left") +
  theme_minimal()

Test 4- Time Spent by Left

Chi-square test

chisq.test(hr$time_spend_company, hr$left)
## 
##  Pearson's Chi-squared test
## 
## data:  hr$time_spend_company and hr$left
## X-squared = 2110.1, df = 7, p-value < 2.2e-16

Technical Interpretation

Since the p-value is <0.01, then we reject the Null hypothesis and can state

that there is a difference in leaving and your time spent at the company.

The x2 of 2110.1 indicates that there is strong difference

Non-technical Interpretation

After 7 years at the company people do not leave. But at year 5 people leave the most often.

Plot

ggplot(hr, aes(x = as.factor(time_spend_company), fill = as.factor(left))) +
  geom_bar(position = "fill") +
  labs( 
    Title = "After 7 Years Employee Stay at the Company", 
    x= "Years Spent at Company", 
    y = "Proportion", 
    fill = "left") +
  theme_minimal()