Question: Please code in google collab showing the steps Consider the titanic dataset titanic.csv. This dataset includes the following variables: Name: The names of the passengers

Please code in google collab showing the steps

Consider the titanic dataset "titanic.csv". This dataset includes the following variables:

Name: The names of the passengers PClass: Passenger class: 1st, 2nd, 3rd Age: Age in years Sex: Male or Female

Survived: 1 = Yes, 0 = No

(a) To avoid confusion later, turn "Survived" 1 into "Yes" and "Survived" 0 into "No". Turn the data into a contingency table, where passenger class is across the top, and survival is down the side. Make sure totals are displayed.

(b) Calculate the conditional distribution of survival given passenger class.

(c) Create a bar plot for the above conditional distribution, with passenger class on the x axis, and survival in the legend.

(d) From (b) and (c), what can you say about the relationship between survival and passenger class?

(e) Create another contingency table, this time, sex is along the top, and survival is down the side.

(f) Calculate the conditional distribution of survival given sex.

(g) Create a bar plot for the above conditional distribution, with sex on the x axis, and survival in the legend.

(h) From (f) and (g), what can you say about the relationship between survival and sex?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!