Chi-Square Test 1: Left vs. Department

a. Chi-Square Test

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

b. Interpretations:

p-value interpretation: The p-value is 7.042e-15, which is extremely small (<0.01), so there is a very low probability that this relationship is due to chance

chi-square test interpretation: There is a strong association between the employee’s department and whether they left the company

non-technical interpretation: Employees in some departments are significantly more likely to leave the company than others. HR employees are most likely to leave, while RandD are least likely.

c. Visualization:

Chi-square test 2: Left vs. Salary

a. Chi-Square Test

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

b. Interpretations:

chi-square test interpretation: There is a strong association between salary level and whether an employee leaves

non-technical interpretation: Employees with lower salaries are significantly more likely to leave the company.

c. Visualization:

Chi-square test 3: Left vs. Promotion in Last 5 Years

a. Chi-Square Test

## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  table(hr$promotion_last_5years, hr$left)
## X-squared = 56.262, df = 1, p-value = 6.344e-14

b. Interpretations:

p-value interpretation: The p-value is 6.344e-14, which is extremely small (<0.01), so promotion history significantly affects attrition

chi-square test interpretation: There is a strong association between promotions and whether an employee leaves

non-technical interpretation: Employees who haven’t been promoted in the last five years are significantly more likely to leave.

c. Visualization:

Chi-square test 4: Left vs. Work Accidents

a. Chi-Square Test

## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  table(hr$Work_accident, hr$left)
## X-squared = 357.56, df = 1, p-value < 2.2e-16

b. Interpretations:

p-value interpretation: The p-value is < 2.2e-16, which is extremely small (<0.01), so workplace accidents significantly influence attrition

chi-square test interpretation: There is a strong association between workplace accidents and whether an employee leaves, where employees without work accidents are over 3 times more likely to leave.

non-technical interpretation: Employees who had workplace accidents are less likely to leave

c. Visualization: