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.

This exercise is part of the course

Hierarchical and Mixed Effects Models in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Include AverageAgeofMother as fixed-effect and LogTotalPop and State as uncorrelated random-effects
model_c <- lmer(BirthRate ~ ___,
                county_births_data)
# Compare outputs of both models 
summary(model_b)
summary(model_c)