Titanic.df <- read.csv(paste("Titanic Data.csv", sep=""))
View(Titanic.df)
Average age of survivors: 28.42
aggregate(Titanic.df$Age, by=list(Titanic.df$Survived), mean)
## Group.1 x
## 1 0 30.41530
## 2 1 28.42382
p-value = 0.02599 which is less than (<0.05) so we will reject the null hypothesis.
library(MASS)
library(psych)
t.test(Titanic.df$Age ~ Titanic.df$Survived, var.equal=TRUE)
##
## Two Sample t-test
##
## data: Titanic.df$Age by Titanic.df$Survived
## t = 2.2302, df = 887, p-value = 0.02599
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 0.238890 3.744064
## sample estimates:
## mean in group 0 mean in group 1
## 30.41530 28.42382