death=read.csv("titanic.csv")

Introduction

In the early Saturday morning of April 15 1912, the RMS Titanic Sank as it was making it’s way through the North Athlanic Ocean traveling from Southampton, England to New York City. Thousands of lives were lost in this incident, but I would like to discover whether the biggest lost was with passengers from a specific class or if there ws no link between deaths and passenger class. The data shows 1313 passengers, their name, their class from 1st to 3rd, their age in years (if applicable), sex (0=male 1=female), if they survived indicated where (0=died, 1=survived). In this project I will compare the number of survivors and what class they were in. As I previously mentioned, if there is a correlation between death rates and the class that each passenger was in, I hope to discover it through this project.

Data Exploration

class<-(death$PClass)
age<-(death$Age)
sex<-(death$SexCode)
survived<-(death$Survived)

Comparing Survival and Class

group<-(death$Survived)
dead<-death[which(group=="0"),]
alive<-death[which(group=="1"),]
#barplot to compare survival rates and class

par(mfrow=c(1,2))
d1<-table(dead$PClass)
a1<-table(alive$PClass)
barplot(d1,main="Deaths per class")
barplot(a1,main="Alive per Class")

summary(dead$PClass)
##   * 1st 2nd 3rd 
##   1 129 160 573
summary(alive$PClass)
##   * 1st 2nd 3rd 
##   0 193 119 138

Comparative Boxplot Analysis

According to my statistical discoveries, it can be proven that a grater amount of individuals from 3rd class died when the Titanic sunk. It can be predicted that this is due to the fact that it was more difficult for these individuals to find a way out of the ship. From the third class, 573 individuals died while only 138 were able to survive.

 #creating a pie chart so that I can see the proportion of passangers who survived from each class (1st, 2nd, and 3rd) 

 par(mfrow=c(1,2))
 slices<-c(129,160,573)
 labels<-c("1st","2nd","3rd")
 pie(slices,labels,main="Pie Chart of Deaths")
 
 
 slices<-c(193,119,138)
 labels<-c("1st","2nd","3rd")
 pie(slices,labels ,main= "Pie Chart of Alive")

Comparative Pie Chart Analysis

It is clearly seen in the pie chart that reprersents deaths from the Titanic that a greater loss was present in passengers from the thrid class. Although the distribution of survivors is fairly equal, almost half of those that survived are 1st class passengers.

Conclusion

As stated in my introduction, the purpose of this paper was to examine if there was a correlation between death and passenger class on the titanic. According to my statistical analysis, I have proven that there is a link between death rate and passenger class. There is a higher death rate among those who were 3rd class passengers than there is among those who were 1st and 2nd clas passengers.