setwd("C:/Users/jaya/downloads")

dean.df<-read.csv(paste("Data - Deans Dilemma.csv",sep=""))

#week 2 day1
# 3d


# 1.  Submit your R code that creates a table showing the mean salary of males and females, who were placed.
placed.df<-dean.df[which(dean.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
# 2.  average salary of males is 284241.9

# 3.  average salary of female is 284241.9

# 4.  Submit 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(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
# 5.  the p-value based on the t-test is 0.00234

# 6.  Please interpret the meaning of the t-test, as applied to the average salaries of male and female MBAs.
# ans).   Here the p-value < 0.05, so our null hypothesis is rejected.
# +  Therefore, there's significant difference between the means of our sample population i.e. it is the average salary of the male MBAs is higher than the average salary of female MBAs.