The analysis is based on the dataset Data - Deans Dilemma.csv.
This file explains the meaning of each column in the given dataset.
dilemma.df<-read.csv("Data - Deans Dilemma.csv")
Use R to create a table showing the average salary of males and females, who were placed. Review whether there is a gender gap in the data. In other words, observe whether the average salaries of males is higher than the average salaries of females in this dataset.
placed.df<-dilemma.df[which(dilemma.df$Placement_B==1),]
aggregate(placed.df$Salary~placed.df$Gender, FUN = mean)
## placed.df$Gender placed.df$Salary
## 1 F 253068.0
## 2 M 284241.9
Clearly, there is a gender gap in the mean salaries.
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.df$Salary~placed.df$Gender,data = placed.df)
##
## Welch Two Sample t-test
##
## data: placed.df$Salary by placed.df$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
placed.df<-dilemma.df[which(dilemma.df$Placement_B==1),]
aggregate(placed.df$Salary~placed.df$Gender, FUN = mean)
## placed.df$Gender placed.df$Salary
## 1 F 253068.0
## 2 M 284241.9
284241.9
253068.0
t.test(placed.df$Salary~placed.df$Gender,data = placed.df)
##
## Welch Two Sample t-test
##
## data: placed.df$Salary by placed.df$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
p-value = 0.00234
Since p-value < 0.05, we would reject our null hypothesis. Thus, there’s significant difference between the means of our sample population i.e. it is true that the average salary of the male MBAs is higher than the average salary of female MBAs.