## 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:

- The type of model to be fitted must be decided on.
- An appropriate MDM file must be created.
- The model is specified and various statistical and output options specified.
- 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:

- MDM for a 2-level model (HLM2) using SPSS input,
- MDM for a 2-level crossed-and-nested design (HCM2) using SPSS input, and
- MDM for a Multivariate Linear 2-level model (HMLM) using SPSS input.

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.

- Example of a 2-level linear (HLM2) model,
- Example of a 2-level crossed-and-nested (HCM2) model, and
- Example of a 2-level multivariate linear (HMLM) model.

## 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:

- Model-based graphs
- Plots for individual level-2 units using the level-1 equation instead of the entire model (Level-1 equation modeling)
- Level-1 residual box-and-whisker plots
- Level-1 residual vs predicted value plots
- Level-2 EB/OLS coefficient confidence intervals
- Three-level graphing

## 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