Various analysis and interpretation for the titanic data sets using the r program was described below.
## Parsed with column specification:
## cols(
## Survived = col_integer(),
## Pclass = col_integer(),
## Sex = col_character(),
## Age = col_double(),
## SibSp = col_integer(),
## Parch = col_integer(),
## Fare = col_double(),
## Embarked = col_character()
## )
The Titanic data set was read into R. And a dataframe called “titanic” was created. The data was viewd and it is found that it consists of 889 bbservations of 8 variables.
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 889 0.38 0.49 0 0.35 0 0 1 1 0.48 -1.77 0.02
The number of passengers on board the titanic was - 899
## Survived
## 0 1
## 549 340
340 passengers surived the sinking of the titanic
## Survived
## 0 1
## 0.6175478 0.3824522
38% People survived the sininking of the Titanic
## Survived
## Pclass 0 1
## 1 80 134
## 2 97 87
## 3 372 119
134 first-class passengers survived the sinking of the Titanic
## Survived
## Pclass 0 1
## 1 0.08998875 0.15073116
## 2 0.10911136 0.09786277
## 3 0.41844769 0.13385827
15 % of the first-class passengers survived the sinking of the Titanic
## , , Survived = 0
##
## Pclass
## Sex 1 2 3
## female 3 6 72
## male 77 91 300
##
## , , Survived = 1
##
## Pclass
## Sex 1 2 3
## female 89 70 72
## male 45 17 47
89 females from First-Class survived the sinking of the Titanic
## Survived
## Sex 0 1
## female 81 231
## male 468 109
## Survived
## Sex 0 1
## female 0.1475410 0.6794118
## male 0.8524590 0.3205882
67.9% of survivors were female
## Survived
## Sex 0 1
## female 81 231
## male 468 109
## Survived
## Sex 0 1
## female 0.09111361 0.25984252
## male 0.52643420 0.12260967
25.9% of females on board the Titanic were survived.
Hypothesis: The proportion of females onboard who survived the sinking of the Titanic was higher than the proportion of males onboard who survived the sinking of the Titanic.
## Survived
## Sex 0 1
## female 81 231
## male 468 109
## Survived
## Sex 0 1 Sum
## female 81 231 312
## male 468 109 577
## Sum 549 340 889
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: mytable
## X-squared = 258.43, df = 1, p-value < 2.2e-16
Since the p value 2.2e-16 is very less we will reject the null hypothesis that sex and survival are independent.