ddilemma.df <- read.csv(paste("Data - Deans Dilemma.csv", sep=""))
attach(ddilemma.df) # attaching the columns of the data frame
library(psych)
STUDENTS WHO WERE SUCCESSFULLY PLACED:
placed.df <- ddilemma.df[ which(ddilemma.df$Placement=='Placed'), ]
boxplot(Salary ~ Gender, data = placed.df, xlab= "Gender", ylab= "average salary", horizontal= TRUE)
Mean salary of males and females, who were placed
aggregate(placed.df$Salary, by= list(placed.df$Gender), FUN=mean)
## Group.1 x
## 1 F 253068.0
## 2 M 284241.9
According to above table, there is a gender gap between the average salary of males and the average salary of females.
H1: The average salary of the male MBAs is higher than the average salary of female MBAs.
t.test(Salary ~ Gender, data = placed.df)
##
## 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
Based on the above output of the t-test, we can reject the hypothesis that the average salary of males is equal the average salary of females.(p<0.001)
What is the average salary of male MBAs who were placed? 284241.90 What is the average salary of female MBAs who were placed? 253068.00 What is the p-value based on the t-test? 0.00234 The t test showed there was a significant difference in the average salaries of males and the average salaries of females.