## Warning: `includeHTML()` was provided a `path` that appears to be a complete HTML document.
## โœ– Path: titanic_report.html
## โ„น Use `tags$iframe()` to include an HTML document. You can either ensure `path` is accessible in your app or document (see e.g. `shiny::addResourcePath()`) and pass the relative path to the `src` argument. Or you can read the contents of `path` and pass the contents to `srcdoc`.
Titanic โ€” Descriptive Analysis Report

Titanic Passenger Dataset

Descriptive Analysis Report ย ยทย  Module 2 Python Assignment

Introduction

The Titanic dataset records information about the 714 passengers aboard the RMS Titanic, which sank on April 15, 1912 after striking an iceberg in the North Atlantic. The disaster claimed over 1,500 lives and remains one of the deadliest peacetime maritime disasters in history.

Each row represents one passenger and includes variables like age, sex, ticket class, fare paid, port of embarkation, and whether they survived. The dataset comes from the Kaggle Titanic competition via Seaborn's built-in datasets. Rows with missing age values were dropped, leaving 714 passengers in the cleaned dataset.

714
Passengers
290
Survived
40.6%
Survival Rate
29.7
Avg Age (yrs)
ยฃ35
Avg Fare

Descriptive Statistics

The table below summarises the key numerical variables โ€” age, fare, siblings/spouses aboard (sibsp), and parents/children aboard (parch). The average passenger was around 30 years old and paid a mean fare of ยฃ34.69, though fares varied a lot as shown by the large standard deviation and wide range.

Variablecountmeanstdmin25%50%75%max
age714.029.714.530.4220.1228.038.080.0
fare714.034.6952.920.08.0515.7433.38512.33
sibsp714.00.510.930.00.00.01.05.0
parch714.00.430.850.00.00.01.06.0

Graph 1: Survival Rate by Passenger Class

Survival Rate by Passenger Class

This bar chart shows survival rates across the three passenger classes. First-class passengers survived at around 65.6%, while third-class was only about 23.9%. The difference is over 40 percentage points, which is pretty significant. This makes sense because third-class quarters were deeper in the ship and harder to evacuate, and crew members were reportedly prioritising wealthier passengers for the limited lifeboats. It basically shows that your ticket class wasn't just about comfort โ€” it determined whether you lived or not.

Graph 2: Age Distribution of Passengers

Age Distribution of Passengers

This histogram shows the age spread across all passengers with a recorded age. Most passengers were between 20 and 40 years old, which is what you'd expect. The mean is 29.7 years and the median is 28.0, so they're pretty close โ€” meaning the distribution is fairly balanced in the middle even though there's a tail on the older end. There's also a small spike at very young ages, showing that there were infants and children on board. The dashed and dotted lines make it easy to compare the mean and median visually.

Graph 3: Fare Distribution by Passenger Class (Box Plot)

Fare Distribution by Passenger Class (Box Plot)

This box plot compares how much passengers paid across each class. First-class fares had the widest spread and the highest median by far, with some serious outliers at the top from passengers paying for private suites. Second class was moderate and pretty consistent. Third class was low and tight, meaning most passengers in that group paid a similar, low amount. Fares above ยฃ300 were removed just to keep the chart readable, but the overall story is clear โ€” fare varied a lot within classes, especially first class.

Graph 4: Survival Count by Sex

Survival Count by Sex

This chart compares survival counts between male and female passengers. Female passengers survived at a much higher rate than males, which lines up with the 'women and children first' evacuation policy that was reportedly followed. Among the 261 female passengers, most survived. Among the 453 male passengers, most did not. Sex ended up being one of the strongest predictors of survival in the whole dataset, which shows how much the social norms of the time shaped who got off the ship.

Graph 5: Age vs. Fare โ€” Coloured by Survival Outcome

Age vs. Fare โ€” Coloured by Survival Outcome

This scatter plot looks at age versus fare and colours each point by survival outcome. Two things stand out pretty quickly. First, passengers who paid higher fares โ€” concentrated at the top of the chart โ€” tended to survive more often, which connects back to the class effect. Second, age alone doesn't really explain survival. Young and old passengers show up across all fare levels without a clear pattern. The cluster of young, low-fare passengers in the bottom-left shows a mixed result, meaning being young didn't help much if you were also in third class.

Conclusion

Across all five graphs, two variables consistently stand out: passenger class and sex. First-class female passengers had the highest likelihood of survival, while third-class male passengers had the lowest. Age played a smaller role, and fare mostly reflects the class effect rather than adding something separate. The data makes it pretty clear that survival on the Titanic wasn't random โ€” it was shaped by socioeconomic status and the social norms of the time.