aggregate(titanic1.df$Age, by=list(titanic1.df$Survived),mean)
## Group.1 x
## 1 0 30.41530
## 2 1 28.42382
t.test(titanic1.df$Survived, titanic1.df$Age)
##
## Welch Two Sample t-test
##
## data: titanic1.df$Survived and titanic1.df$Age
## t = -67.252, df = 890.5, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -30.12544 -28.41697
## sample estimates:
## mean of x mean of y
## 0.3824522 29.6536558
Since the p-value is less than 0.05, hence we reject the null hypothesis. We accept the alternative hypothesis that the titanic survivors were younger than the passengers who died. therefore, the titanic survivors were younger than the passengers who died.