library(stats)
admi1 <- read.csv("Data - Deans Dilemma.csv")
Placed <- admi1[which(admi1$Placement_B==1),]
aggregate(Placed$Salary, by=list(sex= Placed$Gender), mean)
## sex x
## 1 F 253068.0
## 2 M 284241.9
Mean salary of males= 284241.9
Mean salary of females= 253068.0
Null hypothesis: There is no significant difference in average salary of MBA males and females.
Alternate hypothesis: The average salary of the male MBAs is higher than the average salary of female MBAs.
First testing for all placed students:
t.test(Placed$Salary~Placed$Gender)
##
## Welch Two Sample t-test
##
## data: Placed$Salary by Placed$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
p-value: 0.00234
Tesing for all students:
t.test(admi1$Salary~admi1$Gender)
##
## Welch Two Sample t-test
##
## data: admi1$Salary by admi1$Gender
## t = -2.69, df = 278.55, p-value = 0.007577
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -66149.06 -10244.26
## sample estimates:
## mean in group F mean in group M
## 193288.2 231484.8
p-value: 0.00757
In both the above tests, the p<0.05. Therefore we reject the null hypothesis. And conclude that the average salary of male MBA’s is higher is than the average salary of female MBAs.