Chapter 4: Three-level Models for Clustered Data

Note: If given the option, right-click on the files, and choose "Save Link/Target As".

Data Sets
The Classroom Data
Level 1 SPSS Data Set for HLM
Level 2 SPSS Data Set for HLM
Level 3 SPSS Data Set for HLM
MDM Data File for HLM

Syntax for Mixed Model Analyses
SAS Syntax
SPSS Syntax (Version 28)
R Syntax: lme()
R Syntax: lmer()
Stata .do file (Version 17)

Syntax for Descriptive Statistics
SAS Syntax for Descriptive Statistics
SPSS Syntax for Descriptive Statistics
R Syntax for Descriptive Statistics
Stata Do-file for Descriptive Statistics

Syntax for Final Model Diagnostics
SAS Syntax for Final Model Diagnostics
R Syntax for Final Model Diagnostics
Stata Do-File for Final Model Diagnostics
Chapter 4 in the book describes how residual files can be saved in SPSS format using the HLM software, and then how final model diagnostics can be performed using SPSS.

Additional Files
1. Please click here and here for examples of how to produce estimates of marginal variance-covariance matrices for three-level models when using getVarCov() in R. Many thanks to Berwin Turlach from the University of Western Australia for sharing this trick!

Last updated 11/3/21.