The employeenumric data set is 474 by 5
dim(employeenumeric)
## [1] 474 5
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"
116 by 5
edu15 <- subset(employeenumeric, `Years of Education` == 15)
dim(edu15)
## [1] 116 5
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"])
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.
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
P-Value is 1.977e so is veryyy small so there is a 95% chance of this being right
The 95 Confidence Interval basically just means its 95% sure that its right but there is a 5% chance of it being wrong.
No it does not include 0
Men = $33,500 Woman = $27,050
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.
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
P-Value is 0.01755
Its simply stating that it is 95% Confident that it is right.
No
Minority - 28,838 Non Minority - 31,507
We reject the null hypothosis of equal means and the negitive T shows us minority individuals earn significantly less.
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
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
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
interaction.plot(Gender,
`Minority Classification`,
`Current Salary`,
xlab = "Gender",
ylab = "Mean Salary",
trace.label = "Minority Status",
col = c("blue", "red"),
lwd = 2)