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,
No because the the height of the not survived on the chart is taller than the height of the did survive.
3rd class males was the largest group to not survive. On the chart third class males has the largest width corresponding to 1st and 2nd class. The males in third class is taller than the height of the females.
1st class females was the largest group to survive. The width of the 1st class females was wider than the width corresponding to 2nd and 3rd class. The height of the females is taller than the height of males in 1st class.
3rd class males did not survive more cases than expected compared to females. Dark blue box on graph.
2nd class males had survived with less cases than expected compared to 2nd class females. Dark red box indicates less 2nd class males survived than they should have.
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.
No because the height of no patients treated is higher. The largest group that didn’t receive treatment was the placebo group because it is wider than treated. The largest group that did receive treatment was the treated group because it is wider than the placebo treatment group. The people who received marked treatment had more cases than expected, the box was dark blue indicating it had more cases than expected. The marked placebo group had less expected cases than expected, the box was dark red indicating there where less than expected patients treated with placebo.
Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.