Hierarchical and Mixed Effects Models in R
Richard Erickson
Data Scientist
out <- lmer(BirthRate ~ AverageAgeofMother +
(AverageAgeofMother | State),
data = county_births_data)
out # print(out) is what R is calling
Linear mixed model fit by REML ['lmerMod']
Formula: BirthRate ~ AverageAgeofMother + (AverageAgeofMother | State)
Data: county_births_data
REML criterion at convergence: 2337.506
Random effects:
Groups Name Std.Dev. Corr
State (Intercept) 8.8744
AverageAgeofMother 0.2912 -0.99
Residual 1.6742
Number of obs: 578, groups: State, 50
Fixed Effects:
(Intercept) AverageAgeofMother
27.2204 -0.5235
summary(out)
# ...
Scaled residuals:
Min 1Q Median 3Q Max
-2.8399 -0.5966 -0.1133 0.5228 5.1815
Random effects:
Groups Name Variance Std.Dev. Corr
State (Intercept) 78.75478 8.8744
AverageAgeofMother 0.08482 0.2912 -0.99
Residual 2.80306 1.6742
Number of obs: 578, groups: State, 50
Fixed effects:
Estimate Std. Error t value
(Intercept) 27.22041 2.41279 11.282
AverageAgeofMother -0.52347 0.08302 -6.306
Correlation of Fixed Effects:
(Intr)
AvrgAgfMthr -0.997
fixef(out)
(Intercept) AverageAgeofMother
34.5756764 -0.7556129
confint(out)
Computing profile confidence intervals ...
2.5 % 97.5 %
.sig01 0.9458700 1.612440
.sigma 1.6091447 1.815929
(Intercept) 24.0121843 31.146685
AverageAgeofMother -0.6605319 -0.411231
ranef(out)
$State
AK 1.03549148
AL -0.52500819
AR 0.48023356
AZ -1.04094123
CA 0.50530542
CO 0.09585582
CT -1.91638101
DC 0.96029531
DE -0.38938118
FL -1.87440508
GA 0.39776424
#...
Hierarchical and Mixed Effects Models in R