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.
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: The p-value is larger than 0.01, therefore
there is no correlation between average monthly hours and satisfaction
level.
The correlation is not significant.
Correlation estimate interpretation: There is no correlation.
Non-technical interpretation: The more time someone spends at the
company, there is no effect on their satisfaction level.
ggplot(hr, aes(x = average_montly_hours, y = satisfaction_level)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(title = "More time spent at company, no effect on satisfaction",
x = "Average Monthly Hours",
y = "Satisfaction Level")
## `geom_smooth()` using formula = 'y ~ x'
cor.test(hr$time_spend_company , hr$number_project)
##
## Pearson's product-moment correlation
##
## data: hr$time_spend_company and hr$number_project
## t = 24.579, df = 14997, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.1813532 0.2121217
## sample estimates:
## cor
## 0.1967859
P-value interpretation: The p-value is smaller than 0.01, therefore,
there is a correlation between the amount of time spent at the company
and the number of projects.
The correlation is significant.
Correlation estimate interpretation: The correlation is positive, weak
and small.
Non-technical interpretation: The more time spent at the company, the
more projects assigned.
ggplot(hr, aes(x = time_spend_company, y = number_project)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(title = "More time spent at company, the more projects assigned",
x = "Time Spent at Company",
y = "Number of Projects")
## `geom_smooth()` using formula = 'y ~ x'
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 interpretation: The p-value is smaller than 0.01, therefore,
there is a correlation between the time spent at the company and the
satisfaction level.
The correlation is significant.
Correlation estimate interpretation: The correlation is negative, weak
and small.
Non-technical interpretation: The more time spent at a company, the
lower the satisfaction level.
ggplot(hr, aes(x = time_spend_company, y = satisfaction_level)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(title = "More time spent at company, less satisfaction",
x = "Time Spent at Company",
y = "Satisfaction Level")
## `geom_smooth()` using formula = 'y ~ x'
cor.test(hr$time_spend_company , hr$last_evaluation)
##
## Pearson's product-moment correlation
##
## data: hr$time_spend_company and hr$last_evaluation
## 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 smaller than 0.01, therefore,
there is a correlation between the time spent at the company and the
last evaluation score.
The correlation is significant.
Correlation estimate interpretation: The correlation is positive, weak
and small.
Non-technical interpretation: The more time spent at a company, the
higher the last evaluation score.
ggplot(hr, aes(x = time_spend_company, y = last_evaluation)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(title = "More time spent at company, higher last evaluation score",
x = "Time Spent at Company",
y = "Last Evaluation Score")
## `geom_smooth()` using formula = 'y ~ x'