setting up directory to the file location

setwd(“C:/Users/Taiyyab Ali/Desttop/R language”)

Reading file under the given DDilemma

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

# checking if file is accessible
#View(DDilemma)

Q.1 Creatinga table showing the mean salary of males and females,who were placed.

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

Q.2

average salary of male MBAs placed=284241.9 ## Q.3 average salary of female MBAs placed = 253068.0

analysing data by boxplot

boxplot(DDilemma$Salary,DDilemma$Gender)

Q.4 Hypothesis testing using dependent t-test

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

Q.5

p-value < 2.2e-16 (<<0.01)

Q.6

From the p-value, we can reject the hypothesis that average of male and female has no significant difference.