Exercise

Adjusting for non-normal errors

In this last example, it appears as though the points are not normally distributed around the regression line. Again, note that the fix in this exercise has the effect of changing both the variability as well as modifying the linearity of the relationship.

Instructions 1/2

undefined XP
  • 1
    • Run a linear regression of response versus explanatory on hypdata_nonnorm.
    • Get the observation-level information from the model.
    • Using modeled_observations, plot the residuals versus the fitted values.
      • Add a point layer.
      • Add a horizontal line at y = 0 using geom_hline() and setting yintercept to 0.
  • 2
    • Update the model so that the left-hand side of the formula is the square root of response.
    • Rerun the code and look at how the plots change.