R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

#Question 1 : Submit your R code that creates a table showing 
#the mean salary of males and females, who were placed.
dilema.df <- read.csv(paste("Data - Deans Dilemma.csv", sep=""))
placed.df <- dilema.df[which(dilema.df$Placement_B==1),]
aggregate(placed.df[, 26:26], list(placed.df$Gender), mean)
##   Group.1        x
## 1       F 253068.0
## 2       M 284241.9
#Question 2 : What is the average salary of male MBAs who were placed? Ans. 284241.9

#Question 3 : What is the average salary of female MBAs who were placed? Ans. 253068.0

#Question 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(Salary~Gender,placed.df)
## 
##  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
#Question 5 : What is the p-value based on the t-test? Ans. p-value = 0.00234

#Question 6 : Please interpret the meaning of the t-test, as applied to the average salaries of male and female MBAs.

#The null hypothesis is rejected since the p-value < 0.05.Thus there is significance difference between the means of 
#male MBA salaries and female MBA salaries and the average salary of male MBA's is higher than the average 
#salary of female MBA's.

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.