Multilevel models are valuable in a wide array of problem areas that involve non-experimental, or observational data. In many of these cases the data on individual observations may be incomplete. In these situations, the analyst may turn to one of many methods for filling in missing data depending on the specific problem at hand, disciplinary norms, and prior research.
One of the most common cases is to use multiple imputation. Multiple imputation involves fitting a model to the data and estimating the missing values for observations. For details on multiple imputation, and a discussion of some of the main implementations in R, look at the documentation and vignettes for the mice
and Amelia
packages.
The key difficulty multiple imputation creates for users of multilevel models is that the result of multiple imputation is K replicated datasets corresponding to different estimated values for the missing data in the original dataset.
For the purposes of this vignette, I will describe how to use one flavor of multiple imputation and the function in merTools
to obtain estimates from a multilevel model in the presence of missing and multiply imputed data.
To demonstrate this workflow, we will use the hsb
dataset in the merTools
package which includes data on the math achievement of a wide sample of students nested within schools. The data has no missingness, so first we will simulate some missing data.
data(hsb)
# Create a function to randomly assign NA values
add_NA <- function(x, prob){
z <- rbinom(length(x), 1, prob = prob)
x[z==1] <- NA
return(x)
}
hsb$minority <- add_NA(hsb$minority, prob = 0.05)
table(is.na(hsb$minority))
#>
#> FALSE TRUE
#> 6836 349
hsb$female <- add_NA(hsb$female, prob = 0.05)
table(is.na(hsb$female))
#>
#> FALSE TRUE
#> 6830 355
hsb$ses <- add_NA(hsb$ses, prob = 0.05)
table(is.na(hsb$ses))
#>
#> FALSE TRUE
#> 6821 364
hsb$size <- add_NA(hsb$size, prob = 0.05)
table(is.na(hsb$size))
#>
#> FALSE TRUE
#> 6848 337
# Load imputation library
library(Amelia)
# Declare the variables to include in the imputation data
varIndex <- names(hsb)
# Declare ID variables to be excluded from imputation
IDS <- c("schid", "meanses")
# Imputate
impute.out <- amelia(hsb[, varIndex], idvars = IDS,
noms = c("minority", "female"),
m = 5)
#> -- Imputation 1 --
#>
#> 1 2 3
#>
#> -- Imputation 2 --
#>
#> 1 2 3
#>
#> -- Imputation 3 --
#>
#> 1 2 3 4
#>
#> -- Imputation 4 --
#>
#> 1 2 3 4
#>
#> -- Imputation 5 --
#>
#> 1 2 3
summary(impute.out)
#>
#> Amelia output with 5 imputed datasets.
#> Return code: 1
#> Message: Normal EM convergence.
#>
#> Chain Lengths:
#> --------------
#> Imputation 1: 3
#> Imputation 2: 3
#> Imputation 3: 4
#> Imputation 4: 4
#> Imputation 5: 3
#>
#> Rows after Listwise Deletion: 5865
#> Rows after Imputation: 7185
#> Patterns of missingness in the data: 13
#>
#> Fraction Missing for original variables:
#> -----------------------------------------
#>
#> Fraction Missing
#> schid 0.00000000
#> minority 0.04857342
#> female 0.04940849
#> ses 0.05066110
#> mathach 0.00000000
#> size 0.04690327
#> schtype 0.00000000
#> meanses 0.00000000
Fitting a model is very similar
fmla <- "mathach ~ minority + female + ses + meanses + (1 + ses|schid)"
mod <- lmer(fmla, data = hsb)
if(amelia_eval) {
modList <- lmerModList(fmla, data = impute.out$imputations)
} else {
# Use bootstrapped data instead
modList <- lmerModList(fmla, data = impute.out)
}
#> Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl =
#> control$checkConv, : Model failed to converge with max|grad| = 0.00243706
#> (tol = 0.002, component 1)
The resulting object modList
is a list of merMod
objects the same length as the number of imputation datasets. This object is assigned the class of merModList
and merTools
provides some convenience functions for reporting the results of this object.
Using this, we can directly compare the model fit with missing data excluded to the aggregate from the imputed models:
fixef(mod) # model with dropped missing
#> (Intercept) minority female ses meanses
#> 14.042816 -2.701370 -1.182849 1.899924 2.992329
fixef(modList)
#> (Intercept) minority female ses meanses
#> 13.964580 -2.501642 -1.197021 1.930981 3.218819
VarCorr(mod) # model with dropped missing
#> Groups Name Std.Dev. Corr
#> schid (Intercept) 1.53619
#> ses 0.64937 -0.566
#> Residual 6.00409
VarCorr(modList) # aggregate of imputed models
#> $stddev
#> $stddev$schid
#> (Intercept) ses
#> 1.5252886 0.6712887
#>
#>
#> $correlation
#> $correlation$schid
#> (Intercept) ses
#> (Intercept) 1.000000 -0.493787
#> ses -0.493787 1.000000
If you want to inspect the individual models, or you do not like taking the mean across the imputation replications, you can take the merModList
apart easily:
lapply(modList, fixef)
#> $imp1
#> (Intercept) minority female ses meanses
#> 13.963960 -2.506025 -1.187511 1.956362 3.176900
#>
#> $imp2
#> (Intercept) minority female ses meanses
#> 13.965839 -2.476253 -1.207036 1.941314 3.176969
#>
#> $imp3
#> (Intercept) minority female ses meanses
#> 13.968526 -2.573101 -1.172855 1.934888 3.206586
#>
#> $imp4
#> (Intercept) minority female ses meanses
#> 13.961077 -2.427355 -1.230145 1.927593 3.245608
#>
#> $imp5
#> (Intercept) minority female ses meanses
#> 13.963497 -2.525473 -1.187560 1.894750 3.288035
And, you can always operate on any single element of the list:
print(modList)
#> $imp1
#> Linear mixed model fit by REML ['lmerMod']
#> Formula: mathach ~ minority + female + ses + meanses + (1 + ses | schid)
#> Data: d
#>
#> REML criterion at convergence: 46341.7
#>
#> Scaled residuals:
#> Min 1Q Median 3Q Max
#> -3.2121 -0.7269 0.0318 0.7616 2.9230
#>
#> Random effects:
#> Groups Name Variance Std.Dev. Corr
#> schid (Intercept) 2.3241 1.5245
#> ses 0.4518 0.6722 -0.45
#> Residual 35.7631 5.9802
#> Number of obs: 7185, groups: schid, 160
#>
#> Fixed effects:
#> Estimate Std. Error t value
#> (Intercept) 13.9640 0.1736 80.455
#> minority -2.5060 0.1983 -12.634
#> female -1.1875 0.1586 -7.489
#> ses 1.9564 0.1207 16.215
#> meanses 3.1769 0.3606 8.810
#>
#> Correlation of Fixed Effects:
#> (Intr) minrty female ses
#> minority -0.318
#> female -0.483 0.015
#> ses -0.200 0.140 0.043
#> meanses -0.091 0.121 0.023 -0.235
#>
#> $imp2
#> Linear mixed model fit by REML ['lmerMod']
#> Formula: mathach ~ minority + female + ses + meanses + (1 + ses | schid)
#> Data: d
#>
#> REML criterion at convergence: 46354.9
#>
#> Scaled residuals:
#> Min 1Q Median 3Q Max
#> -3.2035 -0.7211 0.0323 0.7596 2.9226
#>
#> Random effects:
#> Groups Name Variance Std.Dev. Corr
#> schid (Intercept) 2.3326 1.5273
#> ses 0.3909 0.6252 -0.52
#> Residual 35.8580 5.9882
#> Number of obs: 7185, groups: schid, 160
#>
#> Fixed effects:
#> Estimate Std. Error t value
#> (Intercept) 13.9658 0.1733 80.570
#> minority -2.4763 0.1993 -12.427
#> female -1.2070 0.1584 -7.620
#> ses 1.9413 0.1193 16.273
#> meanses 3.1770 0.3591 8.846
#>
#> Correlation of Fixed Effects:
#> (Intr) minrty female ses
#> minority -0.315
#> female -0.480 0.007
#> ses -0.211 0.140 0.038
#> meanses -0.096 0.124 0.023 -0.235
#> convergence code: 0
#> Model failed to converge with max|grad| = 0.00243706 (tol = 0.002, component 1)
#>
#>
#> $imp3
#> Linear mixed model fit by REML ['lmerMod']
#> Formula: mathach ~ minority + female + ses + meanses + (1 + ses | schid)
#> Data: d
#>
#> REML criterion at convergence: 46342.5
#>
#> Scaled residuals:
#> Min 1Q Median 3Q Max
#> -3.2214 -0.7222 0.0331 0.7602 2.9194
#>
#> Random effects:
#> Groups Name Variance Std.Dev. Corr
#> schid (Intercept) 2.3567 1.5352
#> ses 0.4808 0.6934 -0.46
#> Residual 35.7520 5.9793
#> Number of obs: 7185, groups: schid, 160
#>
#> Fixed effects:
#> Estimate Std. Error t value
#> (Intercept) 13.9685 0.1743 80.142
#> minority -2.5731 0.1987 -12.947
#> female -1.1729 0.1586 -7.393
#> ses 1.9349 0.1215 15.928
#> meanses 3.2066 0.3613 8.874
#>
#> Correlation of Fixed Effects:
#> (Intr) minrty female ses
#> minority -0.321
#> female -0.481 0.019
#> ses -0.208 0.138 0.042
#> meanses -0.093 0.123 0.025 -0.229
#>
#> $imp4
#> Linear mixed model fit by REML ['lmerMod']
#> Formula: mathach ~ minority + female + ses + meanses + (1 + ses | schid)
#> Data: d
#>
#> REML criterion at convergence: 46359.6
#>
#> Scaled residuals:
#> Min 1Q Median 3Q Max
#> -3.2097 -0.7245 0.0341 0.7595 2.9047
#>
#> Random effects:
#> Groups Name Variance Std.Dev. Corr
#> schid (Intercept) 2.3002 1.5166
#> ses 0.4605 0.6786 -0.51
#> Residual 35.8664 5.9889
#> Number of obs: 7185, groups: schid, 160
#>
#> Fixed effects:
#> Estimate Std. Error t value
#> (Intercept) 13.9611 0.1729 80.758
#> minority -2.4274 0.1981 -12.251
#> female -1.2301 0.1584 -7.765
#> ses 1.9276 0.1213 15.895
#> meanses 3.2456 0.3574 9.082
#>
#> Correlation of Fixed Effects:
#> (Intr) minrty female ses
#> minority -0.317
#> female -0.481 0.010
#> ses -0.219 0.140 0.037
#> meanses -0.095 0.121 0.022 -0.233
#>
#> $imp5
#> Linear mixed model fit by REML ['lmerMod']
#> Formula: mathach ~ minority + female + ses + meanses + (1 + ses | schid)
#> Data: d
#>
#> REML criterion at convergence: 46360.4
#>
#> Scaled residuals:
#> Min 1Q Median 3Q Max
#> -3.2003 -0.7248 0.0339 0.7606 2.9253
#>
#> Random effects:
#> Groups Name Variance Std.Dev. Corr
#> schid (Intercept) 2.3192 1.5229
#> ses 0.4721 0.6871 -0.54
#> Residual 35.8665 5.9889
#> Number of obs: 7185, groups: schid, 160
#>
#> Fixed effects:
#> Estimate Std. Error t value
#> (Intercept) 13.9635 0.1735 80.473
#> minority -2.5255 0.1980 -12.756
#> female -1.1876 0.1589 -7.472
#> ses 1.8948 0.1212 15.637
#> meanses 3.2880 0.3568 9.216
#>
#> Correlation of Fixed Effects:
#> (Intr) minrty female ses
#> minority -0.319
#> female -0.483 0.016
#> ses -0.233 0.138 0.043
#> meanses -0.097 0.118 0.023 -0.231
summary(modList)
#> Warning in modelFixedEff(modList): Between imputation variance is very
#> small, are imputation sets too similar?
#> [1] "Linear mixed model fit by REML"
#> Model family:
#> lmer(formula = mathach ~ minority + female + ses + meanses +
#> (1 + ses | schid), data = d)
#>
#> Fixed Effects:
#> estimate std.error statistic df
#> (Intercept) 13.965 0.174 80.476 2.178458e+09
#> female -1.197 0.159 -7.525 4.567037e+05
#> meanses 3.219 0.361 8.910 1.078433e+05
#> minority -2.502 0.201 -12.425 2.002493e+04
#> ses 1.931 0.121 15.922 2.337436e+05
#>
#> Random Effects:
#>
#> Error Term Standard Deviations by Level:
#>
#> schid
#> (Intercept) ses
#> 1.525 0.671
#>
#>
#> Error Term Correlations:
#>
#> schid
#> (Intercept) ses
#> (Intercept) 1.000 -0.494
#> ses -0.494 1.000
#>
#>
#> Residual Error = 5.985
#>
#> ---Groups
#> number of obs: 7185, groups: schid, 160
#>
#> Model Fit Stats
#> AIC = 46369.8
#> Residual standard deviation = 5.985
fastdisp(modList)
#> Warning in modelFixedEff(x): Between imputation variance is very small, are
#> imputation sets too similar?
#> lmer(formula = mathach ~ minority + female + ses + meanses +
#> (1 + ses | schid), data = d)
#> estimate std.error
#> (Intercept) 13.96 0.17
#> female -1.20 0.16
#> meanses 3.22 0.36
#> minority -2.50 0.20
#> ses 1.93 0.12
#>
#> Error terms:
#> Groups Name Std.Dev. Corr
#> schid (Intercept) 1.53
#> ses 0.67 -0.45
#> Residual 5.99
#> ---
#> number of obs: 7185, groups: schid, 160
#> AIC = 46369.8---
The standard errors reported for the model list include a correction, Rubin’s correction (see documentation), which adjusts for the within and between imputation set variance as well.
modelRandEffStats(modList)
#> term group estimate std.error
#> 1 cor_(Intercept).ses.schid schid -0.4937870 0.040228230
#> 2 sd_(Intercept).schid schid 1.5252886 0.006762784
#> 3 sd_Observation.Residual Residual 5.9850808 0.004875255
#> 4 sd_ses.schid schid 0.6712887 0.026988611
modelFixedEff(modList)
#> Warning in modelFixedEff(modList): Between imputation variance is very
#> small, are imputation sets too similar?
#> term estimate std.error statistic df
#> 1 (Intercept) 13.964580 0.1735254 80.475705 2.178458e+09
#> 2 female -1.197021 0.1590628 -7.525465 4.567037e+05
#> 3 meanses 3.218819 0.3612399 8.910476 1.078433e+05
#> 4 minority -2.501642 0.2013395 -12.424990 2.002493e+04
#> 5 ses 1.930981 0.1212754 15.922281 2.337436e+05
VarCorr(modList)
#> $stddev
#> $stddev$schid
#> (Intercept) ses
#> 1.5252886 0.6712887
#>
#>
#> $correlation
#> $correlation$schid
#> (Intercept) ses
#> (Intercept) 1.000000 -0.493787
#> ses -0.493787 1.000000
Let’s apply this to our model list.
lapply(modList, modelInfo)
#> $imp1
#> n.obs n.lvls AIC sigma
#> 1 7185 1 46359.69 5.980225
#>
#> $imp2
#> n.obs n.lvls AIC sigma
#> 1 7185 1 46372.89 5.988159
#>
#> $imp3
#> n.obs n.lvls AIC sigma
#> 1 7185 1 46360.52 5.979298
#>
#> $imp4
#> n.obs n.lvls AIC sigma
#> 1 7185 1 46377.55 5.988859
#>
#> $imp5
#> n.obs n.lvls AIC sigma
#> 1 7185 1 46378.4 5.988863
summary(modList)
#> Warning in modelFixedEff(modList): Between imputation variance is very
#> small, are imputation sets too similar?
#> [1] "Linear mixed model fit by REML"
#> Model family:
#> lmer(formula = mathach ~ minority + female + ses + meanses +
#> (1 + ses | schid), data = d)
#>
#> Fixed Effects:
#> estimate std.error statistic df
#> (Intercept) 13.965 0.174 80.476 2.178458e+09
#> female -1.197 0.159 -7.525 4.567037e+05
#> meanses 3.219 0.361 8.910 1.078433e+05
#> minority -2.502 0.201 -12.425 2.002493e+04
#> ses 1.931 0.121 15.922 2.337436e+05
#>
#> Random Effects:
#>
#> Error Term Standard Deviations by Level:
#>
#> schid
#> (Intercept) ses
#> 1.525 0.671
#>
#>
#> Error Term Correlations:
#>
#> schid
#> (Intercept) ses
#> (Intercept) 1.000 -0.494
#> ses -0.494 1.000
#>
#>
#> Residual Error = 5.985
#>
#> ---Groups
#> number of obs: 7185, groups: schid, 160
#>
#> Model Fit Stats
#> AIC = 46369.8
#> Residual standard deviation = 5.985
modelFixedEff(modList)
#> Warning in modelFixedEff(modList): Between imputation variance is very
#> small, are imputation sets too similar?
#> term estimate std.error statistic df
#> 1 (Intercept) 13.964580 0.1735254 80.475705 2.178458e+09
#> 2 female -1.197021 0.1590628 -7.525465 4.567037e+05
#> 3 meanses 3.218819 0.3612399 8.910476 1.078433e+05
#> 4 minority -2.501642 0.2013395 -12.424990 2.002493e+04
#> 5 ses 1.930981 0.1212754 15.922281 2.337436e+05
ranef(modList)
#> $schid
#> (Intercept) ses
#> 1224 -1.399143e-01 0.0870214876
#> 1288 -2.029507e-02 0.0209930730
#> 1296 -1.387502e-01 -0.0089081897
#> 1308 9.060509e-02 -0.0457447758
#> 1317 6.838016e-02 -0.0366742092
#> 1358 -2.818154e-01 0.0923422578
#> 1374 -3.777665e-01 0.1339845395
#> 1433 2.725176e-01 -0.0060950439
#> 1436 2.525151e-01 -0.0222370416
#> 1461 -8.627395e-02 0.1483725160
#> 1462 3.233442e-01 -0.1333918276
#> 1477 4.567923e-02 -0.0432910687
#> 1499 -3.181307e-01 0.0955674324
#> 1637 -1.324880e-01 0.0331225424
#> 1906 4.681832e-02 -0.0137194805
#> 1909 -5.288305e-02 0.0323517862
#> 1942 1.966316e-01 -0.0404801434
#> 1946 -3.218928e-02 0.0721722386
#> 2030 -4.210847e-01 0.0250199864
#> 2208 -6.487192e-03 -0.0113346774
#> 2277 2.602357e-01 -0.2385197863
#> 2305 5.242570e-01 -0.2220979374
#> 2336 1.502060e-01 -0.0252668173
#> 2458 2.619321e-01 -0.0380037269
#> 2467 -2.416925e-01 0.0566945925
#> 2526 4.506364e-01 -0.1258336341
#> 2626 5.163045e-02 0.0327197223
#> 2629 3.403597e-01 -0.1159710875
#> 2639 6.473044e-02 -0.0779492331
#> 2651 -4.029183e-01 0.1139582321
#> 2655 6.596490e-01 -0.0621961389
#> 2658 -2.426720e-01 0.0449809087
#> 2755 1.460620e-01 -0.0819997261
#> 2768 -2.479582e-01 0.0848581743
#> 2771 4.371219e-02 0.0430727123
#> 2818 -4.491828e-03 0.0070114057
#> 2917 1.281104e-01 -0.0882143551
#> 2990 4.588319e-01 -0.0710915178
#> 2995 -2.574655e-01 -0.0069496065
#> 3013 -9.979640e-02 0.0495740012
#> 3020 8.354564e-02 -0.0436842394
#> 3039 2.283791e-01 -0.0096086898
#> 3088 -5.936495e-02 -0.0197989752
#> 3152 -3.574201e-02 0.0510562127
#> 3332 -2.514696e-01 0.0054341215
#> 3351 -3.753715e-01 -0.0329565944
#> 3377 1.119774e-01 -0.1241045407
#> 3427 8.509779e-01 -0.2159736932
#> 3498 1.405609e-02 -0.0601425130
#> 3499 -1.526413e-01 -0.0273713481
#> 3533 -1.978000e-01 -0.0130213455
#> 3610 3.139802e-01 -0.0015413182
#> 3657 -5.009415e-02 0.0910862871
#> 3688 8.387615e-03 -0.0300259707
#> 3705 -4.243127e-01 0.0006643509
#> 3716 7.620130e-02 0.0997516459
#> 3838 4.796080e-01 -0.1452775785
#> 3881 -2.859155e-01 0.0525682107
#> 3967 -5.528114e-02 0.0258997861
#> 3992 8.982978e-02 -0.0669851638
#> 3999 -7.807423e-02 0.0796825045
#> 4042 -1.629962e-01 -0.0013027027
#> 4173 -9.154334e-02 0.0481256404
#> 4223 2.919159e-01 -0.0600704384
#> 4253 -5.245953e-02 -0.1001175394
#> 4292 4.824264e-01 -0.1522695765
#> 4325 4.322369e-02 0.0219917820
#> 4350 -3.022826e-01 0.1152436365
#> 4383 -2.289804e-01 0.0816705223
#> 4410 -8.603032e-02 0.0456840195
#> 4420 1.928974e-01 0.0036406506
#> 4458 -4.177671e-02 -0.0242913321
#> 4511 2.382551e-01 -0.1070728572
#> 4523 -2.528129e-01 0.0607102350
#> 4530 5.363988e-02 -0.0206005365
#> 4642 1.198211e-01 0.0235413874
#> 4868 -2.452905e-01 -0.0323862227
#> 4931 -2.106879e-01 0.0296440221
#> 5192 -2.470670e-01 0.0316924716
#> 5404 -2.158925e-01 0.0305173800
#> 5619 -9.054503e-02 0.0949872291
#> 5640 8.676281e-02 0.0449915016
#> 5650 4.793208e-01 -0.1094774343
#> 5667 -2.832204e-01 0.0809240482
#> 5720 1.187385e-01 -0.0044879297
#> 5761 1.462343e-01 0.0108107176
#> 5762 -9.120342e-02 -0.0121329368
#> 5783 -6.455325e-02 0.0117745684
#> 5815 -1.909420e-01 0.0520751759
#> 5819 -3.427290e-01 0.0567897107
#> 5838 -4.330172e-02 0.0046177020
#> 5937 7.015990e-02 -0.0396161585
#> 6074 3.803140e-01 -0.0948826088
#> 6089 2.679939e-01 -0.0767274494
#> 6144 -2.800829e-01 0.0956555049
#> 6170 3.302820e-01 0.0011430677
#> 6291 2.019763e-01 -0.0138928506
#> 6366 1.969135e-01 -0.0448172553
#> 6397 1.875132e-01 -0.0495921582
#> 6415 -6.722504e-02 0.0665583112
#> 6443 -9.745699e-02 -0.0649203444
#> 6464 -4.715221e-02 -0.0137902909
#> 6469 2.976060e-01 -0.0506326255
#> 6484 9.621267e-02 -0.0539022742
#> 6578 3.299875e-01 -0.0731955878
#> 6600 -2.046091e-01 0.1556103932
#> 6808 -3.354575e-01 0.0366785359
#> 6816 2.075283e-01 -0.0841527359
#> 6897 2.875746e-02 0.0586708937
#> 6990 -3.389251e-01 -0.0032399959
#> 7011 5.528705e-02 0.0536884735
#> 7101 -1.317326e-01 -0.0055698337
#> 7172 -2.069157e-01 0.0215594869
#> 7232 -7.958129e-05 0.0700562217
#> 7276 -9.220686e-02 0.0705751886
#> 7332 4.078184e-02 0.0078698866
#> 7341 -2.906345e-01 0.0166689706
#> 7342 7.117216e-02 -0.0372525742
#> 7345 -2.484831e-01 0.1256428877
#> 7364 2.631941e-01 -0.0759474691
#> 7635 6.735063e-02 -0.0217257133
#> 7688 6.103311e-01 -0.1487600362
#> 7697 1.274315e-01 0.0188445088
#> 7734 5.924014e-02 0.0759096078
#> 7890 -3.085090e-01 0.0055988603
#> 7919 -1.316053e-01 0.1101965917
#> 8009 -2.093561e-01 -0.0450702852
#> 8150 1.005283e-01 -0.0757109662
#> 8165 1.738215e-01 -0.0279922313
#> 8175 1.141732e-01 -0.0476553823
#> 8188 -1.195179e-01 0.0719283103
#> 8193 5.708359e-01 -0.1110466009
#> 8202 -2.154225e-01 0.0568820672
#> 8357 1.779093e-01 -0.0170305658
#> 8367 -7.875384e-01 0.1151473352
#> 8477 7.698661e-02 0.0415470127
#> 8531 -2.223920e-01 0.0896911258
#> 8627 -4.182078e-01 0.0659411775
#> 8628 6.084020e-01 -0.1199329555
#> 8707 -9.115985e-02 0.0405670753
#> 8775 -2.215740e-01 0.0101264628
#> 8800 1.251331e-02 0.0069438812
#> 8854 -6.080997e-01 0.1551850607
#> 8857 2.188157e-01 -0.0623912476
#> 8874 1.881203e-01 0.0103110946
#> 8946 -1.465414e-01 0.0047247713
#> 8983 -1.357560e-01 -0.0179624690
#> 9021 -2.605620e-01 0.0254248923
#> 9104 -1.435123e-02 -0.0125625455
#> 9158 -2.798127e-01 0.1137418200
#> 9198 3.129854e-01 -0.0053483729
#> 9225 2.369962e-02 0.0687819911
#> 9292 2.473993e-01 -0.0701204152
#> 9340 -8.268410e-03 0.0286591632
#> 9347 -3.581963e-02 0.0499939562
#> 9359 -2.904600e-02 -0.0609316001
#> 9397 -4.930650e-01 0.1161492623
#> 9508 9.560210e-02 0.0150385488
#> 9550 -2.461625e-01 0.0770399294
#> 9586 -1.196654e-01 -0.0271003565
Often it is desirable to include aggregate values in the level two or level three part of the model such as level 1 SES and level 2 mean SES for the group. In cases where there is missingness in either the level 1 SES values, or in the level 2 mean SES values, caution and careful thought need to be given to how to proceed with the imputation routine.