This is a continuation of the dean’s dilemma case analysis.
hbscase1.df<-read.csv(paste("Data - Deans Dilemma.csv",sep = ""))
View(hbscase1.df)
To test whether the average salary of males is higher than the average salary of females.
library(psych)
## Warning: package 'psych' was built under R version 3.4.3
placed <- hbscase1.df [ which (hbscase1.df$Placement_B == 1),]
aggregate(placed$Salary, by=list(gender = placed$Gender), mean)
## gender x
## 1 F 253068.0
## 2 M 284241.9
Use R to run a t-test to test the following hypothesis: H1: The average salary of the male MBAs is higher than the average salary of female MBAs.
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
The p-value is 0.0023 which is less than 0.05. Hence, we can safely reject the null hypothesis and say that the two groups in our assumed hypothesis have a significant difference. That is, there is a significant difference in the average salary of male MBAs than the average salary of female MBAs.