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?

More passengers perished on the titanic than ones that survived. We can see this because the tiles are much larger in the not survived section.

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

The largest group that did not survive is the 3rd class passengers. They were male and in the third class.

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

The largest group that survived was the first class females, we can see this by it having the largest amount of data in the survived section.

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

One group that had more cases than expected was males dying in the 3rd class. We can tell by this section being a dark blue color.

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

One group that had less cases than expected was first class males not surviving this is seen by their small section being a dark red color.

## 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.

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 people see marked improvement

No more people did not see marked improvement because the marked section is smaller than the other two combined.

## Q2 Describe the largest group that didn’t see improvement. Describe by placebo or treated.

The largest group that did not see improvement was the placebo group, this is because the placebo section is bigger than the treated section in the none section.

## Q3 Describe the largest group that saw improvement Discuss by placebo or treated.

The largest group that saw improvement were the ones that were treated in the marked section.

## Q4 Describe one group that has more cases than expected given independence (by chance). Discuss by treatment and improved.

The group that had more cases than expected was the treated marked group. we can see this because this section is dark blue showing there are more cases than there were expected to be.

## Q5 Describe one group that has less cases than expected given independence (by chance). Discuss by treatment and improved.

The group that had less cases than expected was the placebo marked group. we can see this because this section is dark red showing there are less cases than there were expected to be.

## 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.