Correlation 1: Satisfaction Level vs Last Evaluation

cor_test1 <- cor.test(hr$satisfaction_level, hr$last_evaluation)
cor_test1
## 
##  Pearson's product-moment correlation
## 
## data:  hr$satisfaction_level and hr$last_evaluation
## t = 12.933, df = 14997, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.08916727 0.12082195
## sample estimates:
##       cor 
## 0.1050212

p-value interpretation: The p-value is very small, showing this relationship is significant.
correlation estimate interpretation: The correlation is positive and moderate.
non-technical interpretation: Employees with higher satisfaction levels tend to receive slightly higher evaluation scores.

plot_ly(hr, x = ~last_evaluation, y = ~satisfaction_level,
type = 'scatter', mode = 'markers',
marker = list(opacity = 0.5)) %>%
add_lines(x = ~last_evaluation,
y = fitted(lm(satisfaction_level ~ last_evaluation, data = hr)),
line = list(color = 'red')) %>%
layout(title = "Higher Satisfaction is Linked to Higher Evaluation Scores",
xaxis = list(title = "Last Evaluation Score"),
yaxis = list(title = "Satisfaction Level"))

Correlation 2: Satisfaction Level vs Average Monthly Hours

cor_test2 <- cor.test(hr$satisfaction_level, hr$average_montly_hours)
cor_test2
## 
##  Pearson's product-moment correlation
## 
## data:  hr$satisfaction_level and hr$average_montly_hours
## t = -2.4556, df = 14997, p-value = 0.01408
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.036040356 -0.004045605
## sample estimates:
##         cor 
## -0.02004811

p-value interpretation: The p-value is very small, showing this relationship is significant.
correlation estimate interpretation: The correlation is negative and small.
non-technical interpretation: Employees who work longer hours each month tend to be slightly less satisfied with their jobs.

plot_ly(hr, x = ~average_montly_hours, y = ~satisfaction_level,
type = 'scatter', mode = 'markers',
marker = list(opacity = 0.5)) %>%
add_lines(x = ~average_montly_hours,
y = fitted(lm(satisfaction_level ~ average_montly_hours, data = hr)),
line = list(color = 'red')) %>%
layout(title = "Employees Working Longer Hours Are Less Satisfied",
xaxis = list(title = "Average Monthly Hours"),
yaxis = list(title = "Satisfaction Level"))

Correlation 3: Number of Projects vs Average Monthly Hours

cor_test3 <- cor.test(hr$number_project, hr$average_montly_hours)
cor_test3
## 
##  Pearson's product-moment correlation
## 
## data:  hr$number_project and hr$average_montly_hours
## t = 56.219, df = 14997, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.4039037 0.4303411
## sample estimates:
##       cor 
## 0.4172106

p-value interpretation: The p-value is very small, showing this relationship is significant.
correlation estimate interpretation: The correlation is positive and strong.
non-technical interpretation: Employees handling more projects tend to work more hours on average each month.

plot_ly(hr, x = ~number_project, y = ~average_montly_hours,
type = 'scatter', mode = 'markers',
marker = list(opacity = 0.5)) %>%
add_lines(x = ~number_project,
y = fitted(lm(average_montly_hours ~ number_project, data = hr)),
line = list(color = 'red')) %>%
layout(title = "More Projects Mean More Monthly Work Hours",
xaxis = list(title = "Number of Projects"),
yaxis = list(title = "Average Monthly Hours"))

Correlation 4: Time Spent at Company vs Satisfaction Level

cor_test4 <- cor.test(hr$time_spend_company, hr$satisfaction_level)
cor_test4
## 
##  Pearson's product-moment correlation
## 
## data:  hr$time_spend_company and hr$satisfaction_level
## t = -12.416, df = 14997, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.11668153 -0.08499948
## sample estimates:
##        cor 
## -0.1008661

p-value interpretation: The p-value is very small, showing this relationship is significant.
correlation estimate interpretation: The correlation is negative and weak.
non-technical interpretation: Employees who have been at the company longer tend to report slightly lower satisfaction.

plot_ly(hr, x = ~time_spend_company, y = ~satisfaction_level,
type = 'scatter', mode = 'markers',
marker = list(opacity = 0.5)) %>%
add_lines(x = ~time_spend_company,
y = fitted(lm(satisfaction_level ~ time_spend_company, data = hr)),
line = list(color = 'red')) %>%
layout(title = "Longer Tenure is Linked to Lower Satisfaction",
xaxis = list(title = "Years at Company"),
yaxis = list(title = "Satisfaction Level"))