Exercise

# Plotting residuals

Remember the multiple linear regression that was executed in the previous chapter using the `impact`

dataset, the **dependent variable** `sym2`

and the **independent variables** `ic2`

and `vermem2`

. Plot the residuals of that regression and assess whether the data violates the assumption of homoscedasticity.

Instructions

**100 XP**

- The model from the last chapter has been pre-loaded into the workspace under the name
`model_2`

. Extract the**residuals**from this model by using the`resid()`

function. Save this result in the variable`residual`

. - Plot the residuals in a
**histogram**. Think about whether the residuals appear to be normally distributed or not. **Plot**the residuals against the predicted symptom scores with the residuals on the y-axis. You have to extract the**predicted symptom scores**from the model first, assign them to the variable`predicted`

. Make sure to give your plot the title`"Scatterplot"`

, a title for the x axis`"Model 2 Predicted Scores"`

and a title for the y axis`"Model 2 Residuals"`

.**Add**a red regression line.