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 Did more passengers survive than die?
more passengers died on the titanic than survived
Q2 Describe the largest group that didn’t survive. Discuss by class and gender.
Males in the 3rd class was the largest group to not survive
Q3 Describe the largest group that did survive. Discuss by class and gender.
females in the first classs was the largest group to survive
Q4 Describe one group that has more cases than expected given independence (by chance). Discuss by class and gender.
if one was a 3rd class male one would have a worse chance at survivle (more casses than expected) if one was a 1st class female one would have a better chance at survivle (more cases than expected)
Q5 Describe one group that has less cases than expected given independence (by chance). Discuss by class and gender.
if one was a 3rd class male one would be more likely to not survive (less cases than expected) if one was a first class female one would be less likely to not survive (less cases than expected)
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.
- more people didn’t improve than people who did
- more people who were treated with a placebo didnt change improvement
- more people who were treated with actual treatment improved
- more cases than expected were people who were treated and improved also people who didnt reseve treatment and didnt improve.
- less casses of people were not treated and also improved also people who did reseave treatment and didn’t improve
Q8 Hide the messages, the code and its results on the webpage.
Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.
Q9 Display the title and your name correctly at the top of the webpage.
Q10 Use the correct slug.