aggregate(titanic.df$Age,by=list(titanic.df$Survived), FUN=mean)
## Group.1 x
## 1 0 30.41530
## 2 1 28.42382
Average Age of Survivors: 28.42382 and Dead: 30.41530.
NULL Hypothesis: The titanic survivors were NOT younger than the passengers who died.
t.test(titanic.df$Age, titanic.df$Survived, paired=TRUE)
##
## Paired t-test
##
## data: titanic.df$Age and titanic.df$Survived
## t = 67.065, df = 888, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 28.41458 30.12782
## sample estimates:
## mean of the differences
## 29.2712
P-Value < 2.2e-16
Hence, It our NULL hypothesis is disproved. Hence, The titanic survivors were younger than the passengers who died.