HLM Examples

Getting started with HLM

General information on making the MDM file, model specification, graphing options and output files, which is intended as an introduction to HLM, can be found here. The discussion that follows assumes the use of the Windows graphical user interface of HLM in performing the analysis. It is, however, also possible to run HLM in batch/interactive mode.

To run an analysis in HLM, four steps are required:

  1. The type of model to be fitted must be decided on.
  2. An appropriate MDM file must be created.
  3. The model is specified and various statistical and output options specified.
  4. The model is run, after which model-based graphs can be obtained.

To fit models in HLM, 8 statistical applications are used: HLM2, which fits 2-level linear and nonlinear (HGLM) models; HLM3, which fits 3-level linear/nonlinear models; HLM4, which fits 4-level linear/nonlinear models; HMLM, which fits hierarchical multivariate 2-level linear models; HMLM2, which fits hierarchical multivariate 3-level models; HCM2, which fits 2-level crossed-and-nested models, ; HCM3, which fits 3-level crossed-and-nested models; and HLMHCM, which fits linear models with crossed-and-nested random effects. For specific examples of each step for the different modules, please see below.

 

Making MDM files 

HLM analyses are based on Multivariate Data Matrix (MDM) files. Making the MDM file is the first step in analyzing data using HLM. Users may construct the MDM directly from different types of input files including SPSS, ASCII, SAS, SYSTAT and STATA, or indirectly from many additional types of data file formats through the third-party software module included in the HLM program.

For more detail, please select one of the following:

 

Examples for HLM3 and HMLM2 were not included, as it would, to a very large extent, be a duplication of the material for HLM2 and HMLM. SPSS input was used as this is the most common approach used by HLM users.

 

HLM2 Model 

Fully annotated examples of a 2-level linear (HLM2) model, a 2-level crossed-and-nested model (HCM2) and a hierarchical multivariate linear model (HMLM) are available. A similar approach as in 2 was followed for model specification, due to the close similarity between 2-level (HLM2) and 3-level (HLM3) models, and 2-level multivariate linear (HMLM) and 3-level multivariate linear (HMLM2) models.

 

Data based graphing 

HLM also offers data-and model-based graphing options. Data-based graphing options include group-specific scatter plots, line plots, and cubic splines that can be color coded by values of predictor variables; box-plots displayed for overall data and data grouped within higher-level units. For examples of the data-based graphs, please select one of the following links:

  • Box and whisker plots, which can be used to display univariate distributions of level-1 variables for each level-2 unit, with and without a level-2 classification variable.
  • Line plots, where, for example, level-1 repeated measures observations are joined by lines to describe changes or developments over time during the course of the research study.
  • Scatter plots, which can be used to explore bivariate relationships between level-1 variables for individual or a group of level-2 units, with and without controlling level-2 variables.

 

Model based graphing 

HLM provides graphing options to display the relationships between the outcome and the predictor(s) based on the final analytic results. The options allow us to visually represent the results of the models for the whole or a subset of population, and to graphically examine underlying model assumptions as well. These options are available after running an analysis - for data-based graphics that can be obtained prior to analysis, please see data-based graphs options discussed above.

Model-based graphing options available in HLM include graphing of group-specific equations, box-plots of level-1 residuals for each group, plots of residuals by predicted values for each group, posterior credibility intervals for random coefficients. For three-level models, level-1 trajectories are displayed in separate graphs or grouped by level-3 units. Graphs can be color coded by values of predictor variables.

Five options are available:

   

FIRC models 

   

Augmented imputation models 

 

Additional features of HLM 

In addition, HLM offers the user the option to specify a variety of outcome variable types and a choice of estimation method. As data analyzed with HLM are frequently from complex surveys, the option to include weights at the various levels of the model is also offered. For more on these additional features of HLM please see