Setting up the working directory and creating a dataframe called dean for the data file to be pasted.Then viewing the dataframe.
setwd("C:/Users/Kalyan/Downloads")
dean.df<-read.csv(paste("Data - Deans Dilemma.csv",sep=""))
View(dean.df)
placed<-dean.df[which(dean.df$Placement=='Placed'),]
View(placed)
salary<-aggregate(Salary~Gender,data=placed,mean)
salary
## Gender Salary
## 1 F 253068.0
## 2 M 284241.9
salary
## Gender Salary
## 1 F 253068.0
## 2 M 284241.9
284241.9 is the average salary of the male MBAs who were placed.
salary
## Gender Salary
## 1 F 253068.0
## 2 M 284241.9
253068 is the average salary of the female MBAs who were placed.
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
p-value:0.00234
So we can see that since the p-value is 0.00234 i.e. p<0.05,this rejects the null hypothesis and therefore tells us that there is a difference in the mean salaries of male and female MBAs placed. Also,from this finally we can tell that the average salary of the male MBAs is higher than the average salary of the female MBAs.