placedstudents_df <- filter(DeansDilemmaRaw, DeansDilemmaRaw$Placement_B == "1" )
## Warning: package 'bindrcpp' was built under R version 3.4.1
##placedstudents_df
placedstudents_meanSalary_gender <- aggregate(placedstudents_df$Salary, by= list(placedstudents_df$Gender), mean)
placedstudents_meanSalary_gender
## Group.1 x
## 1 F 253068.0
## 2 M 284241.9
Null Hypothesis would be that - the average salary is independent of Gender
Ttest <- t.test(Salary~Gender, data = placedstudents_df)
Ttest
##
## 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
Ttest$p.value
## [1] 0.00234019
Since the p-value < 0.05, we can conclude that “the average salary of the male MBAs is higher than the average salary of female MBAs”