library(readr)
library(ggplot2)
hr <- read_csv('https://raw.githubusercontent.com/aiplanethub/Datasets/refs/heads/master/HR_comma_sep.csv')
## Rows: 14999 Columns: 10
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): Department, salary
## dbl (8): satisfaction_level, last_evaluation, number_project, average_montly...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

1) average_monthly_hours vs satisfaction_level

cor.test(hr$average_montly_hours, hr$satisfaction_level)
## 
##  Pearson's product-moment correlation
## 
## data:  hr$average_montly_hours and hr$satisfaction_level
## 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: Since the dataset involes 14,999 observations, the p-value of more than .01 renders this correlation statistically insignificant.

correlation estimate interpretation: There is no correlation between average_monthly_hours and satisfaction_levels.

non-technical interpretation: Work hours have no impact on satisfaction levels.

ggplot(hr, aes(x = average_montly_hours, y = satisfaction_level)) +
  geom_point() +
  geom_smooth(method = 'lm')+
  labs(title = "Work Hours Have No Impact on Satisfaction Levels.",
       x = "average_monthly_hours",
       y = "time_spend_company")
## `geom_smooth()` using formula = 'y ~ x'

2) average_monthly_hours vs. time_spend_company

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

p-value interpretation: The p-value is very small, therefore the correlation between average mopnthly hours and time spent at the company is statistically significant.

correlation estimate interpretation: There is a weak positive correlation.

non_technical interpretation: Employees Who Stay Longer Work Slightly More Hours.

ggplot(hr, aes(x = average_montly_hours, y = time_spend_company)) +
  geom_point() +
  geom_smooth(method = 'lm')+
  labs(title = "Employees Who Stay Longer Work Slightly More Hours.",
       x = "average_monthly_hours",
       y = "time_spend_company")
## `geom_smooth()` using formula = 'y ~ x'

3) time_spend_company vs. satisfaction_level

cor.test(hr$time_spend_company, hr$satisfaction_level)
## 
##  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 interprtation: The p-value is very small, therefore the correlation between time_spend_company and satisfaction_level is statisticall significant.

correlation estimate interpretation: There is a weak negative correlation.

non-technical interpretation: Longer Tenured Employees feel slightly less satisfied

ggplot(hr, aes(x = time_spend_company, y = satisfaction_level)) +
  geom_point() +
  geom_smooth(method = 'lm')+
  labs(title = "Longer Tenured Employees Feel Slightly Less Satisfied.",
       x = "time_spend_company",
       y = "satisfaction_level")
## `geom_smooth()` using formula = 'y ~ x'

4) satisfaction_level vs. last_evaluation

cor.test(hr$satisfaction_level, hr$last_evaluation)
## 
##  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 small, therefore the correlation between satisfaction_level and last_evaluation is statistically significant.

correlation estimate interpretation: There is a weak positive correlation.

non-technical interpretation: Employees Felt Slightly More Satisfied on Their Last Evaluation.

ggplot(hr, aes(x = satisfaction_level, y = last_evaluation)) +
  geom_point() +
  geom_smooth(method = 'lm')+
  labs(title = "Employees Felt Slightly More Satisfied on Their Last Evaluation.",
       x = "satisfaction_level",
       y = "last_evaluation")
## `geom_smooth()` using formula = 'y ~ x'