data <- read.csv(paste("Data - Deans Dilemma.csv", sep=""))
View(data)
library(psych)
placed <- data [ which (data$Placement_B == 1),]
aggregate(placed$Salary, by=list(gender = placed$Gender), mean)
## gender x
## 1 F 253068.0
## 2 M 284241.9
Average Salary of Male’s who got their MBa and were placed = 284241.9
Average Salary of Female’s who got their MBa and were placed = 253068.0
A t-test for the Hypothesis “The average salary of the male MBAs is higher than the average salary of 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
The above results show that p-value is 0.002.
Which is less than the standard value of 0.05. Hence, we reject the null hypothesis of the test.
Based on the result we can say that there is a significant difference between the average salary of males and females. This means that our hypothesis is true: “The average salary of the male MBAs is higher than the average salary of female MBAs.”