Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
104 views

Analytical Programming Lab

This document contains a summary of contingency tables analyzing survival rates from Titanic passenger data. The tables show that female passengers, 1st class passengers, children, and those with titles like Miss or Mrs had higher survival rates than expected by chance. The analysis concludes there was bias in selecting who survived based on attributes like gender, class, age and title.

Uploaded by

Kyrsti Deane
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
104 views

Analytical Programming Lab

This document contains a summary of contingency tables analyzing survival rates from Titanic passenger data. The tables show that female passengers, 1st class passengers, children, and those with titles like Miss or Mrs had higher survival rates than expected by chance. The analysis concludes there was bias in selecting who survived based on attributes like gender, class, age and title.

Uploaded by

Kyrsti Deane
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Kyrsti Deane

BCIS 1330 – Data Analytics


Lab 4 – Titanic Contingency Tables

Week 2: Titanic Data Set - Excel Lab 4 – Contingency Tables

Question 1:
Gender Did Not Survive Survived Grand Total
female 27.25% 72.75% 100.00%
male 80.90% 19.10% 100.00%
Grand Total 61.80% 38.20% 100.00%
Only 38.20% of Titanic passengers survived, while 61.80% of passengers did not survive.
Of all survivors, 72.75% were female and 19.10% were male.

Gender Did Not Survive Survived Grand Total


female 15.70% 67.80% 35.60%
male 84.30% 32.20% 64.40%
Grand Total 100.00% 100.00% 100.00%
Of all passengers aboard the Titanic, 64.40% were male and 35.60% were female.
Of all passengers to survive, 67.80% were female and 32.20% were male.

ACTUAL VALUES
Gender Did Not Survive Survived Grand Total
female 127 339 466
male 682 161 843
Grand Total 809 500 1309

EXPECTED VALUES
Gender Did Not Survive Survived Grand Total
female 288 178 466
male 521 843 843
Grand Total 809 500 1309

CHISQ.TEST RESULTS = 3.789678776433E-184


The probability that the differences in variables from actual values and expected values could
occur by chance is significantly small, so close to zero that it is virtually impossible.
It is obvious from the data that women were given preferential treatment in surviving.
Kyrsti Deane
BCIS 1330 – Data Analytics
Lab 4 – Titanic Contingency Tables
Question 2:
P. Class Did Not Survive Survived Grand Total
1 38.08% 61.92% 100.00%
2 57.04% 42.96% 100.00%
3 74.47% 25.53% 100.00%
Grand Total 61.80% 38.20% 100.00%
Only 38.20% of Titanic passengers survived, while 61.80% of passengers did not survive.
Of all survivors, 61.29% were 1st class, 42.96% were 2nd class, and 25.53% were 3rd class.

P. Class Did Not Survive Survived Grand Total


1 15.20% 40.00% 24.68%
2 19.53% 23.80% 21.16%
3 65.27% 36.20% 54.16%
Grand Total 100.00% 100.00% 100.00%
Of all passengers aboard the Titanic, 24.7% were considered 1st class, 21.2% were considered
second class, and 54.2% were considered third class passengers.
Of all survivors, 40% were first class, 23.8% were second class, and 36.2% were third class.

ACTUAL VALUES
P. Class Did Not Survive Survived Grand Total
1 123 200 323
2 158 119 277
3 528 181 709
Grand Total 809 500 1309

EXPECTED VALUES
P. Class Did Not Survive Survived Grand Total
1 200 123 323
2 171 106 277
3 438 271 709
Grand Total 809 500 1309

CHISQ.TEST RESULTS = 1.720825958826E-28


The probability that the differences in variables from actual values and expected values could
occur by chance is significantly small, so close to zero that it is virtually impossible.
It is obvious from the data that first class passengers were given preferential treatment.
Kyrsti Deane
BCIS 1330 – Data Analytics
Lab 4 – Titanic Contingency Tables

Age Group Did Not Survive Survived Grand Total


Adult 60.94% 39.06% 100.00%
Child 44.83% 55.17% 100.00%
Infant 22.73% 77.27% 100.00%
Null (No Age) 72.24% 27.76% 100.00%
Senior Adult 60.82% 39.18% 100.00%
Teen 51.16% 48.84% 100.00%
Young Adult 60.31% 39.69% 100.00%
Grand Total 61.80% 38.20% 100.00%
Only 38.20% of Titanic passengers survived, while 61.80% of passengers did not survive.
Of all survivors, the age groups with the highest mortality rates were infants (77.27%),
children (55.17%), and teenagers (48.84%).

Age Group Did Not Survive Survived Grand Total


Adult 43.39% 45.00% 44.00%
Child 1.61% 3.20% 2.22%
Infant 0.62% 3.40% 1.68%
Null (No Age) 23.49% 14.60% 20.09%
Senior Adult 18.42% 19.20% 18.72%
Teen 2.72% 4.20% 3.28%
Young Adult 9.77% 10.40% 10.01%
Grand Total 100.00% 100.00% 100.00%
Of all passengers aboard the Titanic, 44.0% were considered adults, 18.72% were considered
senior adults, and 20.1% did not have an associated age. Adults & senior adults made up
64.2% of all survivors, 14.6% of survivors had no associated age.

ACTUAL VALUES EXPECTED VALUES


Age Group Did Not Survive Survived Grand Total Age Group Did Not Survive Survived Grand Total
Adult 351 225 576 Adult 356 220 576
Child 13 16 29 Child 18 11 29
Infant 5 17 22 Infant 14 8 22
Null (No Age) 190 73 263 Null (No Age) 163 100 263
Senior Adult 149 96 245 Senior Adult 151 94 245
Teen 22 21 43 Teen 27 16 43
Young Adult 79 52 131 Young Adult 81 50 131
Grand Total 809 500 1309 Grand Total 809 500 1309
CHISQ.TEST RESULTS = 1.377328676928E-05
While many age groups experienced expected probable survival rates, differences in other age
groups show there was bias in selecting who survived, and from which age groups.
Kyrsti Deane
BCIS 1330 – Data Analytics
Lab 4 – Titanic Contingency Tables

Title Did Not Survive Survived Grand Total


Dr 50.00% 50.00% 100.00%
Master 49.18% 50.82% 100.00%
Miss 32.31% 67.69% 100.00%
Mr 83.75% 16.25% 100.00%
Mrs 21.43% 78.57% 100.00%
Rev 100.00% 0.00% 100.00%
Grand Total 61.80% 38.20% 100.00%
NOTE: Titles associated with less than 5 passangers
have been removed for reporting purposes.
Only 38.20% of Titanic passengers survived, while 61.80% of passengers did not survive.
Of all survivors, an overwhelming majority held a woman’s title. No reverends survived.

Title Did Not Survive Survived Grand Total


Dr 0.49% 0.80% 0.61%
Master 3.71% 6.20% 4.66%
Miss 10.38% 35.20% 19.86%
Mr 78.37% 24.60% 57.83%
Mrs 5.19% 30.80% 14.97%
Rev 0.99% 0.00% 0.61%
Grand Total 100.00% 100.00% 100.00%
NOTE: Titles associated with less than 5 passangers
have been removed for reporting purposes.
57.83% of passengers held the title “Mr.” and 78.37% of those holding that title did not survive.
34.83% of passengers held the title “Miss” or “Mrs.”. These passengers made up 66% of all survivors.

ACTUAL VALUES EXPECTED VALUES


Title Did Not Survive Survived Grand Total Title Did Not Survive Survived Grand Total
Dr 4 4 8 Dr 5 3 8
Master 30 31 61 Master 38 23 61
Miss 84 176 260 Miss 161 99 260
Mr 634 123 757 Mr 468 289 757
Mrs 42 154 196 Mrs 121 75 196
Rev 8 0 8 Rev 5 3 8
Grand Total 809 500 1309 Grand Total 809 500 1309
CHISQ.TEST RESULTS = 3.258130645191E-83 NOTE: Titles associated with less than 5 passangers
have been removed for reporting purposes.
The probability that the differences in variables from actual values and expected values could
occur by chance is significantly small, so close to zero that it is virtually impossible.
It is obvious from the data that women were given preferential treatment in surviving.
Kyrsti Deane
BCIS 1330 – Data Analytics
Lab 4 – Titanic Contingency Tables

Port Embarked Did Not Survive Survived Grand Total


C 44.44% 55.56% 100.00%
Q 64.23% 35.77% 100.00%
S 66.74% 33.26% 100.00%
(blank) 0.00% 100.00% 100.00%
Grand Total 61.80% 38.20% 100.00%
Only 38.20% of Titanic passengers survived, while 61.80% of passengers did not survive.
Over half (55.56%) of passengers to board from the Cherbourg port survived.

Port Embarked Did Not Survive Survived Grand Total


C 14.83% 30.00% 20.63%
Q 9.77% 8.80% 9.40%
S 75.40% 60.80% 69.82%
(blank) 0.00% 0.40% 0.15%
Grand Total 100.00% 100.00% 100.00%
Of all passengers aboard the Titanic, 69.82% boarded from the Southampton port and 20.63%
boarded from the Cherbourg port. Of all passengers to survive, 60.8% had boarded the ship
from the Southampton port and 30% boarded from Cherbourg.

ACTUAL VALUES EXPECTED VALUES


Port Embarked Did Not Survive Survived Grand Total Port Embarked Did Not Survive Survived Grand Total
C 120 150 270 C 167 103 270
Q 79 44 123 Q 76 0 123
S 610 304 914 S 565 349 914
(blank) 0 2 2 (blank) 1 1 2
Grand Total 809 500 1309 Grand Total 809 500 1309

CHISQ.TEST RESULTS = 0.000000000000E+00

The probability that the differences in variables from actual values and expected values could
occur by chance is significantly small, so close to zero that it is virtually impossible.
It is obvious from the data that passengers from Cherbourg and Queenstown were given
preferential treatment and survived at a higher rate than they should’ve if left to chance.
Kyrsti Deane
BCIS 1330 – Data Analytics
Lab 4 – Titanic Contingency Tables

Question 3:

Class by Gender Did Not Survive Survived Grand Total


1 123 200 323
female 5 139 144
male 118 61 179
2 158 119 277
female 12 94 106
male 146 25 171
3 528 181 709
female 110 106 216
male 418 75 493
Grand Total 809 500 1309

Gender by Age Group Did Not Survive Survived Grand Total


female 127 339 466
Adult 51 150 201
Child 7 8 15
Infant 1 8 9
Null 31 47 78
Senior Adult 14 70 84
Teen 9 11 20
Young Adult 14 45 59
male 682 161 843
Adult 300 75 375
Child 6 8 14
Infant 4 9 13
Null 159 26 185
Senior Adult 135 26 161
Teen 13 10 23
Young Adult 65 7 72
Grand Total 809 500 1309
Kyrsti Deane
BCIS 1330 – Data Analytics
Lab 4 – Titanic Contingency Tables

Class by Age Group Did Not Survive Survived Grand Total


1 123 200 323
Adult 36 88 124
Child 1 1 2
Infant 1 1
Null 20 19 39
Senior Adult 62 72 134
Teen 2 2
Young Adult 4 17 21
2 158 119 277
Adult 92 62 154
Child 8 8
Infant 7 7
Null 12 4 16
Senior Adult 38 18 56
Teen 9 9
Young Adult 16 11 27
3 528 181 709
Adult 223 75 298
Child 12 7 19
Infant 5 9 14
Null 158 50 208
Senior Adult 49 6 55
Teen 22 10 32
Young Adult 59 24 83
Grand Total 809 500 1309

Port by Class Did Not Survive Survived Grand Total


Cherbourg 120 150 270
1 44 97 141
2 12 16 28
3 64 37 101
Queenstown 79 44 123
1 1 2 3
2 5 2 7
3 73 40 113
Southampton 610 304 914
1 78 99 177
2 141 101 242
3 391 104 495
#N/A 2 2
Grand Total 809 500 1309
Kyrsti Deane
BCIS 1330 – Data Analytics
Lab 4 – Titanic Contingency Tables

Class by Sex by Age Did Not Survive Survived Grand Total


1 123 200 323
female 5 139 144
Adult 2 63 65
Child 1 1
Null 11 11
Senior Adult 2 50 52
Young Adult 15 15
male 118 61 179
Adult 34 25 59
Child 1 1
Infant 1 1
Null 20 8 28
Senior Adult 60 22 82
Teen 2 2
Young Adult 4 2 6
2 158 119 277
female 12 94 106
Adult 7 53 60
Child 4 4
Infant 2 2
Null 1 2 3
Senior Adult 3 16 19
Teen 7 7
Young Adult 1 10 11
male 146 25 171
Adult 85 9 94
Child 4 4
Infant 5 5
Null 11 2 13
Senior Adult 35 2 37
Teen 2 2
Young Adult 15 1 16
3 528 181 709
female 110 106 216
Adult 42 34 76
Child 6 4 10
Infant 1 6 7
Null 30 34 64
Senior Adult 9 4 13
Teen 9 4 13
Young Adult 13 20 33
male 418 75 493
Adult 181 41 222
Child 6 3 9
Infant 4 3 7
Null 128 16 144
Senior Adult 40 2 42
Teen 13 6 19
Young Adult 46 4 50
Grand Total 809 500 1309
Kyrsti Deane
BCIS 1330 – Data Analytics
Lab 4 – Titanic Contingency Tables
Question 4:

Port of Embarkation female male Grand Total


Cherbourg 41.85% 58.15% 100.00%
Queenstown 48.78% 51.22% 100.00%
Southampton 31.84% 68.16% 100.00%
Grand Total 35.60% 64.40% 100.00%
Port of Embarkation female male Grand Total
Cherbourg 24.25% 18.62% 20.63%
Queenstown 12.88% 7.47% 9.40%
Southampton 62.45% 73.90% 69.82%
Grand Total 100.00% 100.00% 100.00%

Data shows that only 35.6% of passengers were female, and that about one in four females boarded the ship
from Cherbourg. 41% of all passengers to board from Cherbourg were female, which may suggest why that
specific port of embarkment saw such significantly higher survival rates.

Port of Embarkation P Class 1 P Class 2 P Class 3 Grand Total


Cherbourg 52.22% 10.37% 37.41% 100.00%
Queenstown 2.44% 5.69% 91.87% 100.00%
Southampton 19.37% 26.48% 54.16% 100.00%
Grand Total 24.68% 21.16% 54.16% 100.00%
Port of Embarkation P Class 1 P Class 2 P Class 3 Grand Total
Cherbourg 43.65% 10.11% 14.25% 20.63%
Queenstown 0.93% 2.53% 15.94% 9.40%
Southampton 54.80% 87.36% 69.82% 69.82%
Grand Total 100.00% 100.00% 100.00% 100.00%

The data also shows that over half of all first-class passengers boarded from the Cherbourg port, which would
be a good indication of why that specific port of embarkment saw significantly higher survival rates.
Passengers of higher status and wealth survived at a higher rate than those in second or third-class. Since more
first-class passengers boarded from Cherbourg, it is not surprising the port had such elevated survival rates.

You might also like