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:
The Titanic data set came from https://osf.io/aupb4/.
In the graph below,
Less passengers survived than died, and more males died than females
The largest group that didn’t survive was males in 3rd class
The largest group that survived were first class females.
A large group of males in third class who are more likely to survive but died
More males shouldn’t have survived in the third class but survived
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.
Q1: More people felt no improvement rather than improvement Q2: The largest group that improved was those who recieved treatment and were marked Q3: The largest group of patients to feel no improvement were those that recieved the placebo Q4: More people who got the treatment and were marked felt no improvement Q5: One group that has less marked improvement than expected was those that recieved the placebo
Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.