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,
More people died than survived.
Third class males was the largest group to not survive.
First class females were the largest group to survive.
There were more third class male passengers that had died than expected. There were more first and second class female passengers that survived than expected.
There were less first and second class females that died than expected. There was less second and third class males to survive than expected.
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.
Less people improved compared to how many did not improve.
The largest group that did not improve were treated with placebo.
The largest group that did improve received treatment.
The groups that received more cases than expected was the group that received placebo, but did not improve and the group that receive treatment and did improve.
The groups that received less cases than expected were treated, but had no improvement and the people who had placebo treatment, but did improve.
Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.