R Markdown

#Perform four (4) correlations using any appropriate variables (continuous).
#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.

#1A.

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

#1B. The p-value of .014 is significantly more than a p-value of 0.001 meaning there is no correlation is not significant.
#1C. Regardless of hours worked your your satisfaction unaffected.
#1D.

ggplot(hr, aes(x = satisfaction_level, y = average_montly_hours)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE, color = "red") +
  labs(title = "Employee's satisfaction Level does not coorelate with Avg Monthly Hours",
       x = "Satisfaction Level",
       y = "Average Monthly Hours")
## `geom_smooth()` using formula = 'y ~ x'

#2A.

cor.test(hr$number_project, hr$time_spend_company)
## 
##  Pearson's product-moment correlation
## 
## data:  hr$number_project and hr$time_spend_company
## 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

#2B. The p-value is less than 2.2e16, this is far less than a p-value of 0.001 meaning there is a greatly significant correlation between variables.
#2C. The more time at the company leads to more projects worked on. #2D.

ggplot(hr, aes(x = number_project, y = time_spend_company)) +
  geom_point() +
  geom_jitter() +
  geom_smooth(method = "lm", se = FALSE, color = "red") +
  labs(title = "The more projects an employee has, the longer time they have been at company",
       x = "Number Projects",
       y = "Time Spent at Company")
## `geom_smooth()` using formula = 'y ~ x'

#3A.

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

#3B. The p-value is less than 2.2e16, this is far less than a p-value of 0.001 meaning there is a greatly significant correlation between variables.
#3C. The greater the avg monthly hours worked, a higher last evaluation. #3D.

ggplot(hr, aes(x = last_evaluation, y = average_montly_hours)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE, color = "red") +
  labs(title = "A Higher Evaluation is equal to Greater Monthly Hours",
       x = "Last Evaluation",
       y = "Avg. Monthly Hours")
## `geom_smooth()` using formula = 'y ~ x'

#4A.

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

#4B. The p-value is less than 2.2e16, this is far less than a p-value of 0.001 meaning there is a greatly significant correlation between variables.
#4C. The more time spent at the company the higher their last evaluation. #4D.

ggplot(hr, aes(x = time_spend_company, y = last_evaluation)) +
  geom_point() +
  geom_jitter() +
  geom_smooth(method = "lm", se = FALSE, color = "red") +
  labs(title = "More time an employee has been at the company leads to greater monthly hours",
       x = "Time Spend at Company",
       y = "Last Evaluation")
## `geom_smooth()` using formula = 'y ~ x'