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,

## # A tibble: 1,313 x 5
##    Name                                          PClass   Age Sex    Survived
##    <chr>                                         <chr>  <dbl> <chr>     <dbl>
##  1 Allen, Miss Elisabeth Walton                  1st    29    female        1
##  2 Allison, Miss Helen Loraine                   1st     2    female        0
##  3 Allison, Mr Hudson Joshua Creighton           1st    30    male          0
##  4 Allison, Mrs Hudson JC (Bessie Waldo Daniels) 1st    25    female        0
##  5 Allison, Master Hudson Trevor                 1st     0.92 male          1
##  6 Anderson, Mr Harry                            1st    47    male          1
##  7 Andrews, Miss Kornelia Theodosia              1st    63    female        1
##  8 Andrews, Mr Thomas, jr                        1st    39    male          0
##  9 Appleton, Mrs Edward Dale (Charlotte Lamson)  1st    58    female        1
## 10 Artagaveytia, Mr Ramon                        1st    71    male          0
## # … with 1,303 more rows
##                 Sex female male
## Survived PClass                
## 0        1st             9  120
##          2nd            13  147
##          3rd           132  441
## 1        1st           134   59
##          2nd            94   25
##          3rd            80   58

Q1 Are more passengers survived?

##                 Sex female male
## Survived PClass                
## 0        1st             9  120
##          2nd            13  147
##          3rd           132  441
## 1        1st           134   59
##          2nd            94   25
##          3rd            80   58

Q2 Describe the largest group that didn’t survive. Discuss by class and gender.

The males in the 3rd class was the largest group to not survive because the people in the 3rd class were the first to die, and men died before the women.

Q3 Describe the largest group that did survive. Discuss by class and gender.

First class females were the largest group to survive, because the first class females got to enter the safety boats first before everyone else was allowed too.

Q4 Describe one group that has more cases than expected given independence (by chance). Discuss by class and gender.

First class males I thought would’ve been a lot less because they were first class and very wealthy.

Q5 Describe one group that has less cases than expected given independence (by chance). Discuss by class and gender.

Less second class men survived compared to the third class men. I thought it would’ve been a different way around.

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.

The males in the 3rd class was the largest group to not survive because the people in the 3rd class were the first to die, and men died before the women.

First class females were the largest group to survive, because the first class females got to enter the safety boats first before everyone else was allowed too.

First class males I thought would’ve been a lot less because they were first class and very wealthy.

Less second class men survived compared to the third class men. I thought it would’ve been a different way around.

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.