In this exercise you will learn to visualize the pairwise relationships between a set of quantitative variables. To this end, you will make your own note of 8.5 Mosaic plots from Data Visualization with R.
Mosaic charts can display the relationship between categorical variables using:
- rectangles whose areas represent the proportion of cases for any given combination of levels, and
- the color of the tiles to indicate the degree relationship among the variables.
The Titanic data set came from https://osf.io/aupb4/.
In the graph below,
- dark blue represents more cases than expected given independence (by chance); and
- dark red represents less cases than expected if independence holds (by chance).

Q1 Are more passengers survived?
According to the table, 762 people died and 445 survived, so more people died than survived.
Q2 Describe the largest group that didn’t survive. Discuss by class and gender.
The largest group that didn’t survive was 3rd class males.
Q3 Describe the largest group that did survive. Discuss by class and gender.
The largest group that survived was 1st class females.
Q4 Describe one group that has more cases than expected given independence (by chance). Discuss by class and gender.
Dark blue represents more cases than expected given independence, so one group that had more cases than expected was 3rd class males who did not survive.
Q5 Describe one group that has less cases than expected given independence (by chance). Discuss by class and gender.
The red represents more less than expected given independence, so one group that had less cases than expected were 1st class females who did not survive.
Q6 Create a mosaic plot for Arthritis in the same way as above.
Hint: The Arthritis data set is from the vcd package. Add an additional argument gp = shading_max in the mosaic function. This is because the residuals are too small to have color.

Q7 Repeat Q1-Q5.
- Of the 84 total people, 41 were actually treated and 43 were placebo’d.
- The largest group of people were placebo’d people who saw no improvements.
- The largest group that did see improvement were people who actually got treated.
- One group that had more cases than expected given independence were placebo’d people who saw no improvement.
- One group that had less cases than expected given independence were treated people who saw no improvements
Q8 Hide the messages, the code and its results on the webpage.
Done.
Q9 Display the title and your name correctly at the top of the webpage.
Q10 Use the correct slug.