Objective

In this assignment, you will analyze employee attrition data using correlations and visualization techniques in R. You will perform a correlation, interpret the results, both in technical and in non-technical terms, and create the appropriate graph.

Data

The dataset contains information about employees, including their satisfaction levels, last evaluation scores, number of projects, average monthly hours, time spent at the company, work accidents, promotion history, department, and salary.

Tasks: Perform four (4) correlations using any appropriate variables (continuous).

For each of the four correlations:

  1. Perform the correlation (.5 point) Choose any two appropriate variables from the data and perform the correlation, displaying the results.

  2. Interpret the results in technical terms (.5 point) For each correlation, explain what the test’s p-value means (significance).

  3. Interpret the results in non-technical terms (1 point) For each correlation, what do the results mean in non-techical terms.

  4. Create a plot that helps visualize the correlation (.5 point) For each correlation, create a graph to help visualize the realtionship between the two variables. The title must be the non-technical interpretation.

Submission

Submit your assignment by providing a link to your published RPubs document containing all the required visualizations and explanations.

Total: 10 points

Starter code

Use this code to read the data. Note that you will need additional libraries

library(readr)

hr <- read_csv('https://raw.githubusercontent.com/aiplanethub/Datasets/refs/heads/master/HR_comma_sep.csv')

Example of a succesful correlation

cor.test(mtcars$mpg , mtcars$hp)
## 
##  Pearson's product-moment correlation
## 
## data:  mtcars$mpg and mtcars$hp
## t = -6.7424, df = 30, p-value = 1.788e-07
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.8852686 -0.5860994
## sample estimates:
##        cor 
## -0.7761684

p-value interpretation: The p-value is very small, therefore the correlation between mpg and hp is significant.

correlation estimate interpretation: The correlation is negative and large

non-technical interpretation: The more HP, less fuel efficiency

library(ggplot2)

ggplot(mtcars, aes(x = hp, y = mpg)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE, color = "red") +
  labs(title = "More Horsepower, less Fuel Efficiency",
       x = "Horsepower",
       y = "Miles per Gallon")

Good luck!