mba.df <- read.csv("Data - Deans Dilemma.csv")
placed<- mba.df[which(mba.df$Placement_B==1),]
aggregate(Salary~Gender,data=placed,FUN=mean)
## Gender Salary
## 1 F 253068.0
## 2 M 284241.9
avgsal<-aggregate(Salary~Gender,data=placed,FUN=mean)
avgsal[2,2]
## [1] 284241.9
Null Hypothesis
There is no significant difference between the salaries of males and females.
t.test(Salary ~ Gender, data = placed)
##
## Welch Two Sample t-test
##
## data: Salary by Gender
## t = -3.0757, df = 243.03, p-value = 0.00234
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -51138.42 -11209.22
## sample estimates:
## mean in group F mean in group M
## 253068.0 284241.9
The p-value is 0.00234.
2.After performing a t-test on the two variables we can see that the p value is 0.003287, which is too low and hence the NULL hypothesis here that the mean salary of men is NOT significantly higher than the women will be rejected which shows us that the average salary of men is indeed higher than that of women.