setwd(“C:/Users/Taiyyab Ali/Desttop/R language”)
DDilemma <- read.csv(paste("Data - Deans Dilemma.csv",sep=""))
# checking if file is accessible
#View(DDilemma)
aggregate(DDilemma$Salary,by=list(Gender=DDilemma$Gender,
Placement=DDilemma$Placement),mean)
## Gender Placement x
## 1 F Not Placed 0.0
## 2 M Not Placed 0.0
## 3 F Placed 253068.0
## 4 M Placed 284241.9
average salary of male MBAs placed=284241.9 ## Q.3 average salary of female MBAs placed = 253068.0
boxplot(DDilemma$Salary,DDilemma$Gender)
H1: “The average salary of the male MBAs is higher than the average salary of female MBAs.”
t.test(DDilemma$Salary,DDilemma$Gender.B,paired=TRUE)
##
## Paired t-test
##
## data: DDilemma$Salary and DDilemma$Gender.B
## t = 31.32, df = 390, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 205325.9 232830.0
## sample estimates:
## mean of the differences
## 219077.9
p-value < 2.2e-16 (<<0.01)
From the p-value, we can reject the hypothesis that average of male and female has no significant difference.