library(readr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
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.
Correlation 1: 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
Interpret the results in technical terms: The p-value exceeded the
0.01 cutoff point. The correlation is between -0.1 and 0 whichs suggests
no correlation.
Interpret the results in non-technical terms: There is no
relationship between Average Monthly Hours and Satisfaction Level.
ggplot(hr, aes(x = average_montly_hours, y = satisfaction_level)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(title = "There is no Relationship Between Average Monthly Hours and Satisfaction Level",
x = "Average Monthly Hours",
y = "Satisfaction Level")
## `geom_smooth()` using formula = 'y ~ x'

Correlation 2: Satisfaction Level vs Number of Projects
cor.test(hr$satisfaction_level, hr$number_project)
##
## Pearson's product-moment correlation
##
## data: hr$satisfaction_level and hr$number_project
## t = -17.69, df = 14997, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.1586105 -0.1272570
## sample estimates:
## cor
## -0.1429696
Interpret the results in technical terms: The p-value is within the
0.01 cutoff point. The correlation suggests that there is a weak
negative correlation.
Interpret the results in non-technical terms: As satisfaction level
decreases, the number of projects increases slightly.
ggplot(hr, aes(x = number_project, y = satisfaction_level)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(title = "As Satisfaction Level Decreases, the Number of Projects Increases Slightly",
x = "Number of Projects",
y = "Satisfaction Level")
## `geom_smooth()` using formula = 'y ~ x'

Correlation 3: Satisfaction Level vs Last Evaluation Score
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
Interpret the results in technical terms: The p-value is within the
0.01 cutoff point. The correlation suggests a weak positive
correlation.
Interpret the results in non-technical terms: As satisfaction level
increases, the evaluation score increases slightly.
ggplot(hr, aes(x = last_evaluation, y = satisfaction_level)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(title = " As Satisfaction Level Increases, the Evaluation Score Increases Slightly",
x = "Last Evaluation Score",
y = "Satisfaction Level")
## `geom_smooth()` using formula = 'y ~ x'

Correlation 4: Satisfaction Level vs Time Spent at the 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
Interpret the results in technical terms: The p-value is within the
0.01 cutoff point. The correlation suggests that there is a weak
negative correlation.
Interpret the results in non-technical terms: As satisfaction level
decreases, the time spent at the company increases.
ggplot(hr, aes(x = time_spend_company, y = satisfaction_level)) +
geom_point() +
geom_smooth(method = "lm", se = FALSE, color = "red") +
labs(title = "As Satisfaction Level Decreases, the Time spent at the Company Increases",
x = "Time Spent at Company",
y = "Satisfaction Level")
## `geom_smooth()` using formula = 'y ~ x'
