1. Learn
  2. /
  3. Courses
  4. /
  5. Hierarchical and Mixed Effects Models in R

Connected

Exercise

Uncorrelated random-effect slope

In the previous exercise, you use lme4's' default setting and assumed slopes and intercepts within each group were correlated for the random-effect estimates. However, this assumption may not always be valid or we may want to simplify the model if we are having trouble numerically fitting the model.

Building a model with uncorrelated random-effects is one method for potentially simplifying the model. Furthermore, lmer() models can be hard to fit and checking model outputs can be a useful step when debugging your model. Alternatively, you may have subject matter expertise and want to assume the random-effects are not correlated.

To fit a model with an uncorrelated random-effect slope, use || rather than | with lmer() syntax.

The second model you built in the previous exercise, model_b has been loaded for you. Compare the outputs of model_c to the old outputs from model_b.

The lme4 lmer vignette includes a section on uncorrelated random-effects.

Instructions 1/2

undefined XP
    1
    2
  • Build a model with AverageAgeofMother as a fixed-effect and LogTotalPop as an uncorrelated random-effect slope with State.
  • Compare the summary() outputs for each model.