Basic Comparison of age of survivors

Read Data

titanic.df <- read.csv(paste("TitanicData.csv", sep=""))
attach(titanic.df)

Average age of placed Students by whether they survived or not

aggregate(Age, by=list(Survived=Survived), mean)
##   Survived        x
## 1        0 30.41530
## 2        1 28.42382

Average age of survivors = 28.42382 , non-survivors = 30.41530

Boxplots

boxplot(Age~ Survived, data=titanic.df, xlab="Age", ylab="Survived",horizontal=TRUE)

We can see that the age of survivors are less than those who did not survived.

Test the null hypothesis

Run a t-test to test the following hypothesis: The Titanic survivors were younger than the passengers who died.

Since the age are independent of whether a passenger survived or not we run a independent T-test

t.test(Age~ Survived, data=titanic.df)
## 
##  Welch Two Sample t-test
## 
## data:  Age by Survived
## t = 2.1816, df = 667.56, p-value = 0.02949
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.1990628 3.7838912
## sample estimates:
## mean in group 0 mean in group 1 
##        30.41530        28.42382

p-value is 0.02949 < 0.05
Thus we can reject the null hypothesis.
This implies that the Titanic survivors were younger than the passengers who died.