The table for mean salary of male and female :
mytable<-aggregate(Salary~Gender,data = placed1,mean)
mytable
## Gender Salary
## 1 F 253068.0
## 2 M 284241.9
Average Salarry of males who were placed is:
mytable<-placed1[which(placed1$Gender.B=="0"),]
m.sal<-mean(mytable$Salary)
m.sal
## [1] 284241.9
Average Salarry of females who were placed is:
mytable2<-placed1[which(placed1$Gender.B=="1"),]
f.sal<-mean(mytable2$Salary)
f.sal
## [1] 253068
The given hypothesis is:The average salary of the male MBAs is higher than the average salary of female MBAs. To check this hypothesis, we you the t-test for independent groups.
t.test(Salary~Gender,data = placed1)
##
## 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
As its clear from the test, p-value<0.05. This means that the hypothesis - “The average salary of the male MBAs is higher than the average salary of female MBAs” is True.
THANK YOU