Analysis of Survival Rate by Gender on the Titanic

Jun 24, 2024, 4:54 AM

Survival rate by gender

Survival Rate by Gender

  • Female: 74.2%
  • Male: 18.9%
The survival rate for females was significantly higher compared to males on the Titanic.

Visualize this for me

  • A bar plot was created using Plotly to visualize the survival rate by gender on the Titanic.
  • The graph shows the survival rate as a percentage for both male and female passengers.
  • Visual enhancements were applied, including percentage formatting and displaying the survival rate values outside the bars.

Visualize this for me

Fit a model to predict SVM to predict the surviaal.

  • We have selected features Pclass, Sex, Age, SibSp, Parch, Fare, and Embarked to predict the target variable Survived.
  • Categorical variables were converted to numeric using one-hot encoding.
  • Missing values in Age and Fare were filled with their respective medians.
  • The dataset was split into training and testing sets with an 80-20 split.
  • An SVM model with a linear kernel was trained on the training set.
  • The model achieved an accuracy of approximately 78.21% on the test set.

Visualize this for me

A bar plot was created using Plotly to visualize the accuracy of an SVM model in predicting survival on the Titanic. The plot includes the accuracy percentage displayed on the bar and is customized for better visual presentation.

Continue the analysis

Analysis Summary

  • **Classification Report: **
    • Not Survived: Precision: 0.80, Recall: 0.84, F1-score: 0.82
    • Survived: Precision: 0.75, Recall: 0.70, F1-score: 0.73
    • Overall Accuracy: 0.78
  • Confusion Matrix:
    • True Positives (Not Survived): 88
    • False Negatives (Not Survived): 17
    • False Positives (Survived): 22
    • True Positives (Survived): 52

Perform the exploratory data analysis for the givendata

Key Points from the Exploratory Data Analysis

  1. Dataset Overview:
    • The dataset contains information about Titanic passengers, including features like PassengerId, Survived, Pclass, Name, Sex, Age, SibSp, Parch, Ticket, Fare, Cabin, and Embarked.
  2. Missing Values:
    • Significant missing values in Age (177), Cabin (687), and a few in Embarked (2).
  3. Summary Statistics:
    • Average age: ~29.7 years.
    • Majority of passengers were male (577 out of 891).
    • Most passengers embarked from port 'S' (644 out of 889).
    • Fare ranged from 0 to 512.
  4. Visualizations:
    • Age Distribution: Majority of passengers are between 20-40 years old.
    • Fare Distribution: Most fares are below 50, but there are some high outliers.
    • Survival Rate by Class: Higher survival rate for 1st class passengers.
    • Survival Rate by Gender: Higher survival rate for females.
    • Survival Rate by Embarkation Port: Slightly higher survival rate for passengers who embarked from port 'C'.
These insights highlight the importance of passenger class, gender, and embarkation port in survival outcomes, as well as the need to address missing values in the dataset.

PLot a various exploratory graph against survival and analyze them

Exploratory Data Analysis on Titanic Survival

We have plotted several exploratory graphs to analyze survival rates against different features in the Titanic dataset:
  1. Survival Rate by Age:
    • The survival rates vary across different age groups with noticeable patterns in certain age ranges.
  2. Survival Rate by Fare:
    • Higher fares seem to have a correlation with higher survival rates.
  3. Survival Rate by Number of Siblings/Spouses Aboard (SibSp):
    • The survival rate appears to fluctuate with the number of siblings/spouses aboard.
  4. Survival Rate by Number of Parents/Children Aboard (Parch):
    • The number of parents/children aboard also shows variability in survival rates.
These visualizations help in understanding the relationships between different features and the survival rates on the Titanic.

Are there any significant differences in survival rates between male and female passengers that could be explored further in relation to age and class?

The analysis of the Titanic dataset reveals differences in survival rates between male and female passengers when considering age and class. Key findings include:
  • Survival rates by age and gender: Visualizations indicate that female passengers had higher survival rates across various age groups compared to male passengers.
  • Survival rates by class and gender: Female passengers also had higher survival rates across different passenger classes compared to males.
These results suggest that gender, age, and class were significant factors influencing survival rates on the Titanic.
Get started with Vizly