เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

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.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Hierarchical and Mixed Effects Models in R

ดูคอร์ส

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# 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)
แก้ไขและรันโค้ด