Snijders and Bosker (1999) use as a running example a study of 2287 eighth-grade pupils (aged about 11) in 132 classes in 131 schools in the Netherlands. Only the variables used in our examples are supplied.

nlschools

Format

This data frame contains 2287 rows and the following columns:

lang

language test score.

IQ

verbal IQ.

class

class ID.

GS

class size: number of eighth-grade pupils recorded in the class (there may be others: see COMB, and some may have been omitted with missing values).

SES

social-economic status of pupil's family.

COMB

were the pupils taught in a multi-grade class (0/1)? Classes which contained pupils from grades 7 and 8 are coded 1, but only eighth-graders were tested.

Source

Snijders, T. A. B. and Bosker, R. J. (1999) Multilevel Analysis. An Introduction to Basic and Advanced Multilevel Modelling. London: Sage.

References

Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.

Examples

op <- options(digits=5) nl1 <- within(nlschools, { IQave <- tapply(IQ, class, mean)[as.character(class)] IQ <- IQ - IQave }) cen <- c("IQ", "IQave", "SES") nl1[cen] <- scale(nl1[cen], center = TRUE, scale = FALSE) nl.lme <- nlme::lme(lang ~ IQ*COMB + IQave + SES, random = ~ IQ | class, data = nl1) summary(nl.lme)
#> Linear mixed-effects model fit by REML #> Data: nl1 #> AIC BIC logLik #> 15120 15178 -7550.2 #> #> Random effects: #> Formula: ~IQ | class #> Structure: General positive-definite, Log-Cholesky parametrization #> StdDev Corr #> (Intercept) 2.78707 (Intr) #> IQ 0.48424 -0.516 #> Residual 6.24839 #> #> Fixed effects: lang ~ IQ * COMB + IQave + SES #> Value Std.Error DF t-value p-value #> (Intercept) 41.370 0.35364 2151 116.985 0.0000 #> IQ 2.124 0.10070 2151 21.088 0.0000 #> COMB1 -1.672 0.58719 130 -2.847 0.0051 #> IQave 3.248 0.30021 130 10.818 0.0000 #> SES 0.157 0.01465 2151 10.697 0.0000 #> IQ:COMB1 0.431 0.18594 2151 2.317 0.0206 #> Correlation: #> (Intr) IQ COMB1 IQave SES #> IQ -0.257 #> COMB1 -0.609 0.155 #> IQave -0.049 0.041 0.171 #> SES 0.010 -0.190 -0.001 -0.168 #> IQ:COMB1 0.139 -0.522 -0.206 -0.016 -0.003 #> #> Standardized Within-Group Residuals: #> Min Q1 Med Q3 Max #> -4.059387 -0.631084 0.065519 0.717864 2.794540 #> #> Number of Observations: 2287 #> Number of Groups: 133