RMS Titanic Report Part1

The sinking of the RMS Titanic occurred on the night of 14 April through to the morning of 15 April 1912 in the North Atlantic Ocean, four days into the ship’s maiden voyage from Southampton to New York City. The largest passenger liner in service at the time, Titanic had an estimated 2,224 people on board when she struck an iceberg at around 23:40 (ship’s time) on Sunday, 14 April 1912. Her sinking two hours and forty minutes later at 02:20 (05:18 GMT) on Monday, 15 April resulted in the deaths of more than 1,500 people, which made it one of the deadliest peacetime maritime disasters in history.

  1. Reading data given in CSV format file into R
setwd("C:/Users/Dell/Desktop/Project/Week 2/Day1/Task 3")
titanic.df=read.csv("Titanic Data.csv")
View(titanic.df)
  1. Creating a table showing the average age of the survivors and the average age of the people who died.
Avg=aggregate(titanic.df$Age, by=list(Survived=titanic.df$Survived), mean)
Avg
##   Survived        x
## 1        0 30.41530
## 2        1 28.42382
  1. Running a t-test to test the hypothesis the Titanic survivors were younger than the passengers who died.
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

Based on the above output of the t-test, we cannot reject the hypothesis that the Titanic survivors were younger than the passengers who died. (p>0.001)