Titanic T test

4a

TitanicT_test<-read.csv("C:/Users/here_is_sachin/Downloads/Titanic Data.csv")

4b

TitanicT_test<-read.csv("C:/Users/here_is_sachin/Downloads/Titanic Data.csv")
by(TitanicT_test$Age, TitanicT_test$Survived , mean)
## TitanicT_test$Survived: 0
## [1] 30.4153
## -------------------------------------------------------- 
## TitanicT_test$Survived: 1
## [1] 28.42382

H2: The Titanic survivors were younger than the passengers who died.

TitanicT_test<-read.csv("C:/Users/here_is_sachin/Downloads/Titanic Data.csv")
t.test(TitanicT_test$Survived, TitanicT_test$Age, paired = TRUE)
## 
##  Paired t-test
## 
## data:  TitanicT_test$Survived and TitanicT_test$Age
## 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:
##  -30.12782 -28.41458
## sample estimates:
## mean of the differences 
##                -29.2712

p-value< 2.2e-16

The average age of people who Died is greater than average of people who Survived.