Session Ready
Exercise

Rescaling slopes

Previously, the plot suggested the model requires a random-effect intercept and likely requires a random-effect slope. For this model, include Year as both a fixed- and random-effect. This estimates a global slope across all counties as well as a random-effect slope for each county. The fixed-effect slope estimate indicates how major crimes are changing in the State of Maryland across all counties. The random-effect slopes correct for counties having different changes in crime.

However, fitting this model produces a warning message. To address this warning, Year needs to be changed from starting at 2006 to starting at 0. This has been done for you as Year2 (e.g., 2006 in Year is 0 in Year2). When fitting regressions, scaling or centering the intercept to start at 0 can be an important transformation for numerical stability.

Instructions
100 XP
  • Build a lmer() to predict Crime with Year as both a fixed-effect and random-effect slope and County as the random-effect intercept.
  • Build a second lmer() to predict Crime with Year2 as both a fixed-effect and random-effect slope and County as the random-effect intercept.