Recall the Data - Dean’s Dilemma.csv data file associated with the case “A Dean’s Dilemma: Selection of Students for the MBA Program”
dean.df <- read.csv(paste("Deans Dilemma.csv", sep =""))
Create a dataframe called placed, that contains a subset of only those students who were successfully placed.
placed <-dean.df[which(dean.df$Placement_B== "1"),]
1.R code that creates a table showing the mean salary of males and females, who were placed.
aggregate(placed$Salary, by=list(gender=placed$Gender), mean)
## gender x
## 1 F 253068.0
## 2 M 284241.9
2.The average salary of male MBAs who were placed=284241.9
aggregate(placed$Salary, by=list(gender=placed$Gender), mean)
## gender x
## 1 F 253068.0
## 2 M 284241.9
3.The average salary of female MBAs who were placed=253068
aggregate(placed$Salary, by=list(gender=placed$Gender), mean)
## gender x
## 1 F 253068.0
## 2 M 284241.9
4.R code to run a t-test for the Hypothesis “The average salary of the male MBAs is higher than the average salary of female MBAs.”
t.test(Salary~Gender, data=placed)
##
## 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
5.The p-value based on the t-test=0.00234
6.Interpretation of t-test
a)Male MBAs have a higher average salary at 284241.9 compared to female MBAs who have an average salary of 253068.
b)The t test showed there is a significant difference in average salary of the male and female MBAs who were placed(since p-value < 0.05)