setwd("/home/nimit")
deanDilemma<- read.csv("Data - Deans Dilemma.csv")
#View(deanDilemma)
placed<- deanDilemma[which(deanDilemma$Placement_B == 1),] #Subset of placed student
aggregate(placed$Salary, by=list(placed$Gender), mean) #Gender wise Average salary of placed student
## Group.1 x
## 1 F 253068.0
## 2 M 284241.9
Average salary of male is higher than of female.
H1: The average salary of the male MBAs is higher than the average salary of female MBAs.
t-test to test the hypothesis:
malePlaced<- placed[which(placed$Gender=='M'),]
femalePlaced<- placed[which(placed$Gender=='F'),]
t.test(malePlaced$Salary,femalePlaced$Salary)
##
## Welch Two Sample t-test
##
## data: malePlaced$Salary and femalePlaced$Salary
## 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:
## 11209.22 51138.42
## sample estimates:
## mean of x mean of y
## 284241.9 253068.0
Mean salary gender wise:
aggregate(placed$Salary, by=list(placed$Gender), mean)
## Group.1 x
## 1 F 253068.0
## 2 M 284241.9
Average Salary of male who were placed:
mean(malePlaced$Salary)
## [1] 284241.9
Average Salary of female who were placed:
mean(femalePlaced$Salary)
## [1] 253068
t-test for the Hypothesis: The average salary of the male MBAs is higher than the average salary of female MBAs
t.test(malePlaced$Salary,femalePlaced$Salary)
##
## Welch Two Sample t-test
##
## data: malePlaced$Salary and femalePlaced$Salary
## 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:
## 11209.22 51138.42
## sample estimates:
## mean of x mean of y
## 284241.9 253068.0
p-value = 0.00234
Interpret the result:
In placed MBA students, male have higher average salary than female. The t test showed there was a significant difference in average salary between male and female. ( p-value < 0.05 ).