Quarto Presentation
Titanic Dataset
INTRODUCTION
- This is an introduction to creating presentation output using Quarto
- Notice how headers are used to create pages of content
- This is just a simple example - we will improve on the design and flow throughout the semester
- Use the CRISP-DM Model to create a relevant story line
![Image: Crisp-DM]()
Data Understanding
- We will use the Titanic dataset for our analysis
- The dataset has information on all 1309 passengers aboard the Titanic when it sank in April 1912
- The dataset has the following variables
'data.frame': 1309 obs. of 12 variables:
$ PassengerId: int 1 2 3 4 5 6 7 8 9 10 ...
$ Survived : int 0 1 1 1 0 0 0 0 1 1 ...
$ Pclass : int 3 1 3 1 3 3 1 3 3 2 ...
$ Name : chr "Braund, Mr. Owen Harris" "Cumings, Mrs. John Bradley (Florence Briggs Thayer)" "Heikkinen, Miss. Laina" "Futrelle, Mrs. Jacques Heath (Lily May Peel)" ...
$ Sex : chr "male" "female" "female" "female" ...
$ Age : num 22 38 26 35 35 NA 54 2 27 14 ...
$ SibSp : int 1 1 0 1 0 0 0 3 0 1 ...
$ Parch : int 0 0 0 0 0 0 0 1 2 0 ...
$ Ticket : chr "A/5 21171" "PC 17599" "STON/O2. 3101282" "113803" ...
$ Fare : num 7.25 71.28 7.92 53.1 8.05 ...
$ Cabin : chr "" "C85" "" "C123" ...
$ Embarked : chr "S" "C" "S" "S" ...
Passenger Statistics by Gender
- The Titanic had more men than women – almost two-thirds were men.
- Percent distribution by gender
Passenger Statistics by Survival
- These data show that fewer passengers survive than did not survive.
- However, there are quite a few passengers for whom no survival information is available.
Did Not Survive Survived Unsure
549 342 418
- Percent distribution by survival
Did Not Survive Survived Unsure
41.9 26.1 31.9
Passenger Statistics by Gender and Survival
- About half of the women are known to have survived
- While over half of the men are known to have perished
Cross-Tabulation, Row Proportions
Sex * Survived.f
Data Frame: titanic
-------- ------------ ----------------- ------------- ------------- ---------------
Survived.f Did Not Survive Survived Unsure Total
Sex
female 81 (17.4%) 233 (50.0%) 152 (32.6%) 466 (100.0%)
male 468 (55.5%) 109 (12.9%) 266 (31.6%) 843 (100.0%)
Total 549 (41.9%) 342 (26.1%) 418 (31.9%) 1309 (100.0%)
-------- ------------ ----------------- ------------- ------------- ---------------
Passenger Statistics by Gender and Survival
- Most of the non-survivors were men while most of the survivors were women.
Cross-Tabulation, Column Proportions
Sex * Survived.f
Data Frame: titanic
-------- ------------ ----------------- -------------- -------------- ---------------
Survived.f Did Not Survive Survived Unsure Total
Sex
female 81 ( 14.8%) 233 ( 68.1%) 152 ( 36.4%) 466 ( 35.6%)
male 468 ( 85.2%) 109 ( 31.9%) 266 ( 63.6%) 843 ( 64.4%)
Total 549 (100.0%) 342 (100.0%) 418 (100.0%) 1309 (100.0%)
-------- ------------ ----------------- -------------- -------------- ---------------
Average Age by Gender
- The average age of passengers on board the Titanic is 30
- The average age of female passengers is 29
- The average age of male passengers is 31
Average Age by Survival
Survivors tended to be younger than those who did not survive.
| Did Not Survive |
31 |
| Survived |
28 |
| Unsure |
30 |
Average Age by Gender and Survival
Non-surviving females are younger than surviving females. The opposite is true among males.
The youngest group are female non-survivors.
| female |
Did Not Survive |
25 |
| female |
Survived |
29 |
| female |
Unsure |
30 |
| male |
Did Not Survive |
32 |
| male |
Survived |
27 |
| male |
Unsure |
30 |
Average Age by Fare Class and Survival
- Passengers booked fares in First, Second, or Third class
- First class passengers tended to be older, regardless of survival status
| Did Not Survive |
1 |
44 |
| Did Not Survive |
2 |
34 |
| Did Not Survive |
3 |
27 |
| Survived |
1 |
35 |
| Survived |
2 |
26 |
| Survived |
3 |
21 |
| Unsure |
1 |
41 |
| Unsure |
2 |
29 |
| Unsure |
3 |
24 |
Average Age by Fare Class, Gender, and Survival
Among males, those who did not survive tended to be older than survivors, regardless of fare class.
Among females, first class passengers who did not survive were younger than survivors.
Start your analysis using the Embark variable here
Note that passengers embarked at one of three locations.
S: Southampton, England
C: Cherbourg, France
Q: Queenstown, Ireland
Cross-Tabulation, Row Proportions
as.factor(titanic$Pclass) * Embarked.f
--------------------------- ------------ ------------- ------------- ------------- ---------- ---------------
Embarked.f C Q S Unknown Total
as.factor(titanic$Pclass)
1 141 (43.7%) 3 ( 0.9%) 177 (54.8%) 2 (0.6%) 323 (100.0%)
2 28 (10.1%) 7 ( 2.5%) 242 (87.4%) 0 (0.0%) 277 (100.0%)
3 101 (14.2%) 113 (15.9%) 495 (69.8%) 0 (0.0%) 709 (100.0%)
Total 270 (20.6%) 123 ( 9.4%) 914 (69.8%) 2 (0.2%) 1309 (100.0%)
--------------------------- ------------ ------------- ------------- ------------- ---------- ---------------
- Class 1 embarked at either Cherbourg or Southampton
- Class 2 was predominately made up of passengers that embarked at Southampton
- Class 3 was predominately passengers from Southampton.
Total Number of Passengers by Survival Status and Gender
Percentage of Total Passengers by Survival and Gender
Average Age by Fare Class
![]()
- Plot that shows the average age by fare class
- First class Titanic passengers were, on average, older than those in second and third class.
Count of Survial: Adults versus Children
Here I test the legitimacy of the old phrase, “Woman and Children First”. We have already seen that far more woman than men survived. Here we explore children:
With Percentages:
![]()
- Among children, there was a smaller disparity between those who survived and those who didn’t
- Among adults far more perished than survived.
Families vs Individuals
Next, let’s explore whether or not families were more likely to survive by comparing the survival rate of passengers with parents or children on board with those that did not.
![]()
- Based on this graph it does appear that more people survived that were a part of families than those that were not.