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. Satisfaction Level vs. Time Spent at
Company
cor.test(hr$satisfaction_level , hr$time_spend_company)
##
## Pearson's product-moment correlation
##
## data: hr$satisfaction_level and hr$time_spend_company
## 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,
therefore the correlation between satisfaction level and time spent at
the company is significant.
correlation estimate interpretation: The
correlation is negative and very weak.
non-technical interpretation: As the time that
employees have spent at the company increases, their satisfaction level
tends to slightly decrease. Although, this relationship is very weak so
may not be very reliable.
ggplot(hr, aes(x = time_spend_company, y = satisfaction_level)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "#243ee9") +
labs(title = " As the time that employees have spent at the company increases,
their satisfaction level tends to slightly decrease",
x = "Time Spent at Company",
y = "Satisfaction Level")
## `geom_smooth()` using formula = 'y ~ x'

2. Last Evaluation vs. Number of Projects
cor.test(hr$last_evaluation , hr$number_project)
##
## Pearson's product-moment correlation
##
## data: hr$last_evaluation and hr$number_project
## t = 45.656, df = 14997, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.3352028 0.3633053
## sample estimates:
## cor
## 0.3493326
p-value interpretation: The p-value is very small,
therefore the correlation between last evaluation and number of projects
is significant.
correlation estimate interpretation: The
correlation is positive and weak.
non-technical interpretation: As the number of
projects increases, the last evaluation tends to increase slightly.
ggplot(hr, aes(x = number_project, y = last_evaluation)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "#d23322") +
labs(title = "As the number of projects increases, the last evaluation tends to increase ",
x = "Number of Projects",
y = "Last Evaluation")
## `geom_smooth()` using formula = 'y ~ x'

3. Satisfaction Level vs. Average Monthly
Hours
cor.test(hr$satisfaction_level , hr$average_montly_hours)
##
## 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 small,
therefore the correlation between satisfaction level and average monthly
hours is significant.
correlation estimate interpretation: The
correlation is negative and very weak. Since the correlation is so
small, it shows that there is barely a relationship between the two
variables at all.
non-technical interpretation: As the average
monthly hours increases, the satisfaction level decreases very slightly,
if at all.
ggplot(hr, aes(x = average_montly_hours, y = satisfaction_level)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "#9922d2") +
labs(title = " As the average monthly hours increases, the satisfaction level
decreases very slightly, if at all.",
x = "Average Monthly Hours",
y = "Satisfaction Level")
## `geom_smooth()` using formula = 'y ~ x'

4. Last Evaluation vs. Time Spent at Company
cor.test(hr$last_evaluation , hr$time_spend_company)
##
## Pearson's product-moment correlation
##
## data: hr$last_evaluation and hr$time_spend_company
## t = 16.256, df = 14997, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.1158309 0.1472844
## sample estimates:
## cor
## 0.1315907
p-value interpretation: The p-value is very small,
therefore the correlation between last evaluation and time spent at the
company is significant.
correlation estimate interpretation: The
correlation is negative very weak.
non-technical interpretation: As the time spent at
the company increases, last evaluation increases slightly.
ggplot(hr, aes(x = time_spend_company, y = last_evaluation)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "#22d228") +
labs(title = "As the time spent at the company increases, last evaluation increases slightly.",
x = "Time Spent at Company",
y = "Last Evaluation")
## `geom_smooth()` using formula = 'y ~ x'
