This is the analysis of Dean’s Data to analyse the gender Gap using t-test.

Creating a data frame placed which contains the datails of students who are placed.

mbadata <- read.csv(paste("Data - Deans Dilemma.csv", sep="")) #creating a data frame called "titanic"
placed <- mbadata [ which(mbadata$Placement_B == '1') , ]
View(placed)

3 b) To create a table showing the average salary of males and females, who were placed.

tabl=aggregate(Salary~Gender,data=placed,FUN = mean)
tabl
##   Gender   Salary
## 1      F 253068.0
## 2      M 284241.9

Average Salary of Male MBAs who are placed

tabl[2,2]
## [1] 284241.9

Average Salary of Female MBAs who are placed

tabl[1,2]
## [1] 253068

Average Salary of male MBAs who are placed is Rs. 231484.8 and that of Female MBAs who are placed is Rs. 193288.2. We observe that there is a Gender Gap because The average Salary of males is greater than the average salary of females in the data Set.

Generating box plots for each group

boxplot(placed$Salary~placed$Gender,main = "Average Salary of Male MBAs and Female MBAs", horizontal = TRUE, ylab = "Gender (Male/Female)", xlab = "Salary" ,col = (c("green","blue")), ylab = "Average Salary")

3 c) 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 , who are placed.

Let us consider this Null Hypothesis :The is no significant difference between the average salary of male MBAs and 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

Since p-value of the test is 0.00234, p<0.05, we rejest the Null Hypothesis that there is no significant difference the average salaries of Male and Female MBAs who are placed. So, we can conclude that there is a signicant difference between the average salaries of Male and female MBAs who are placed, ie, The average salary of the male MBAs is higher than the average salary of female MBAs.