Exercise

# Visualizing parallel slopes

The two plots in the previous exercise gave very different predictions: one gave a predicted response that increased linearly with a numeric variable; the other gave a fixed response for each category. The only sensible way to reconcile these two conflicting predictions is to incorporate both explanatory variables in the model at once.

When it comes to a linear regression model with a numeric and a categorical explanatory variable, `ggplot2`

doesn't have an easy, "out of the box" way to show the predictions. Fortunately, the `moderndive`

package includes an extra geom, `geom_parallel_slopes()`

to make it simple.

`taiwan_real_estate`

is available; `ggplot2`

and `moderndive`

are loaded.

Instructions

**100 XP**

- Using the
`taiwan_real_estate`

dataset, plot house prices versus the number of nearby convenience stores, colored by house age. - Make it a scatter plot.
- Add parallel slopes, without a standard error ribbon.