1. What are the dimensions of the data set?

The employeenumric data set is 474 by 5

dim(employeenumeric)
## [1] 474   5

2. What variables are included in the data?

These variables are gender, salarys, years of education, minority classification, and individuals date of births

names(employeenumeric)
## [1] "Gender"                  "Current Salary"         
## [3] "Years of Education"      "Minority Classification"
## [5] "Date of Birth"

3. What are the dimensions of the new dataframe you created?

116 by 5

edu15 <- subset(employeenumeric, `Years of Education` == 15)
dim(edu15)
## [1] 116   5

4. What is the null hypothesis?

The null hypothosis shoes there is not a real difference in means between current salary between men and woman with the new data set of 15 years of education because the P value is close to equal 0. but the T statistic shows there is a difference

attach(edu15)
t_gender <- t.test(`Current Salary`[Gender == "m"],`Current Salary`[Gender == "f"])

5. Why do you think I asked you to include only samples with 15 years of education?

Personaly I thought 15 years of education was included because most people have around that ammount so we can look at an average or normal education that men and woman would be able to accessably have. Including up to college level but not a Masters or a PhDs.

6. (1) What is the t-statistic for the difference in salaries between men and women with 15 years of education?

t_gender
## 
##  Welch Two Sample t-test
## 
## data:  `Current Salary`[Gender == "m"] and `Current Salary`[Gender == "f"]
## t = 5.0443, df = 102.38, p-value = 1.977e-06
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  3930.779 9024.884
## sample estimates:
## mean of x mean of y 
##  33527.83  27050.00

7. What is the p-value?

P-Value is 1.977e so is veryyy small so there is a 95% chance of this being right

8. What are the limits of the 95% CI?

The 95 Confidence Interval basically just means its 95% sure that its right but there is a 5% chance of it being wrong.

9. Does the 95% CI contain (include) the value 0?

No it does not include 0

10. What are the mean salaries for men and women with 15 years of education?

Men = $33,500 Woman = $27,050

11. Referring back to your null and alternative hypotheses, what do you conclude from the results of this test?

at first because the number was so small I thought that there was no difference but looking back there is a quite big difference so the hypothesis is not valid personally.

12. What is the t-statistic for the difference in salaries between minority and non-minority respondents with 15 years of education?

t_minority <- t.test(`Current Salary`[`Minority Classification` == 0], `Current Salary`[`Minority Classification` == 1])
t_minority
## 
##  Welch Two Sample t-test
## 
## data:  `Current Salary`[`Minority Classification` == 0] and `Current Salary`[`Minority Classification` == 1]
## t = 2.4432, df = 59.458, p-value = 0.01755
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##   664.4916 6673.2519
## sample estimates:
## mean of x mean of y 
##  32507.33  28838.46

13. What is the p-value?

P-Value is 0.01755

14. What are the limits of the 95% CI?

Its simply stating that it is 95% Confident that it is right.

15. Does the 95% CI contain the value 0?

No

16. What are the mean salaries for minorities and non-minorities with 15 years of education?

Minority - 28,838 Non Minority - 31,507

17. What do you conclude from the results of the t-test?

We reject the null hypothosis of equal means and the negitive T shows us minority individuals earn significantly less.

18. Compare, using a t-test for the difference in means, minority vs. non-minority men. Is there a significant difference at 95%?

There is a difference between the median salarys between minority and non-minority men Non-minority men earn more than Minority men

t_men <- t.test(`Current Salary`[Gender == "m" & `Minority Classification` == 0], `Current Salary`[Gender == "m" & `Minority Classification` == 1])
t_men
## 
##  Welch Two Sample t-test
## 
## data:  `Current Salary`[Gender == "m" & `Minority Classification` == 0] and `Current Salary`[Gender == "m" & `Minority Classification` == 1]
## t = 2.4005, df = 40.643, p-value = 0.02104
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##   702.7293 8164.9289
## sample estimates:
## mean of x mean of y 
##  34489.38  30055.56

19. Compare, using a t-test for the difference in means, minority vs. non-minority women. Is there a significant difference at 95%?

No there is no significant difference between the minority and non minority woman

t_men <- t.test(`Current Salary`[Gender == "f" & `Minority Classification` == 0], `Current Salary`[Gender == "f" & `Minority Classification` == 1])
t_men
## 
##  Welch Two Sample t-test
## 
## data:  `Current Salary`[Gender == "f" & `Minority Classification` == 0] and `Current Salary`[Gender == "f" & `Minority Classification` == 1]
## t = 0.62398, df = 11.646, p-value = 0.5447
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -3139.546  5647.546
## sample estimates:
## mean of x mean of y 
##     27354     26100

20. Fill in the following table:

Non-Minority Male 34,489 Female 27,354

Minority Male 30,055 Female 26,100

mean_table <- with(edu15, tapply(`Current Salary`,list(Gender, `Minority Classification`), mean, na.rm = TRUE))
mean_table
##          0        1
## f 27354.00 26100.00
## m 34489.38 30055.56

21. Include the plot and describe what it tells you about how differences in salary relate to the interaction between sex and minority status for people with 15 years of education.

interaction.plot(Gender,
                 `Minority Classification`,
                 `Current Salary`,
                 xlab = "Gender",
                 ylab = "Mean Salary",
                 trace.label = "Minority Status",
                 col = c("blue", "red"),
                 lwd = 2)