HLM stands for Hierarchical Linear Model. The HLM software is designed to do statistical analyses using data with a hierarchical structure. The HLM/2 program analyzes data with two hierarchical levels, for example students nested within schools. The HLM/3 program analyzes data with three hierarchical levels, for example students nested within classrooms, nested within schools. The conceptual approach is one in which the parameters of level-1 are considered to be functions of level-2 variables (for example).
The HLM software includes five modules, each designed for a different type of analysis
In version 6 of HLM, the "linear" component of the title is, to some extent, a misnomer, since version 6 also handles several nonlinear models, including bernoulii models (logistic regression), binomial models, poisson models, multinomial models and ordinal models.
The current release of the HLM programs is 6.02. The previous release was 5.00. There are several new features for release 6.02.
HLM Version 6, statistical software for UNIX is available on strauss. The Windows version is available in the Research & Data Management Services Lab (room 002C Smith Hall).
These instructions are for running HLM programs on the UNIX server, strauss. For extensive tutorials on the Windows system, see the HLM web site. Each of the five modules is run in two steps: (1) Create an .mdm file, and (2) run the analysis. This document gives a complete example of how to create the .mdm file and run an HLM2 model. The other programs (HLM3, HMLM, and HMLM/2) run in analogous fashion.
The unix commands for each of the programs are --
(Unix commands lower case.)
Data analysis using the HLM/2 program typically has three stages:
This section contains general instructions for preparing the command files and running the program. Detailed examples are contained in command files and interactive sessions accessible from this document as links.
To create the .mdm file interactively, at the strauss prompt type
hlm2
and respond to the prompts
To create the .mdm file using batch mode, create a UNIX file which contains the responses to the program's prompts. Then, if the file is named hsb.mdmt, at the strauss prompt type --
hlm2 -R hsb.mdmt
The command file hsb.mdmt contains short keywords or phrases preceding a colon (:) or preceded by an asterisk (*) describing each entry. For example
rawdattype:ascii
indicates the type of input data is an ASCII text file. And the variable names for each level are demarcated by a beginning and ending keyphrase. The level-one variables in this example are set off by *begin l1vars and *end l1vars
*begin l1vars MINORITY FEMALE SES MATHACH *end l1vars
Notice that the filename extension for the command file to create the .mdm file is changed since HLM 5 from .rsp to .mdmt.
Whether you run interactively or use batch mode, the program creates a file named creatmdm.mdmt in your current working directory. The file is a log of all the information accepted by the program as responses to its prompts. This log file can be renamed and used as a subsequent input file to create an .mdm file. If you run batch mode, creatmdm.mdmt will be identical to your command file hsb.mdmt.
Phase one of the analysis, creating the .mdm file, writes descriptive statistics for all variables to the screen and to a file named HLM2MDM.STS, in your current working directory. (Remember that UNIX filenames are case sensitive.) If the file already exists, its contents are replaced. If you want to save a record of these statistics for each of multiple runs, make a copy of the HLM2MDM.STS file before executing a new run. For example
cp HLM2MDM.STS hsbModel1.sts
How to translate the .mdm file into an ASCII file. This step is generally not needed. However, if you want to read the contents of the .mdm file in an editor or another program, you must first translate it into an ASCII file. For example, to translate a file named hsb.mdm into an ASCII file named hsb.suffstat, at the strauss prompt type
prssm2 hsb.mdm > ! hsb.suffstat
In this example, the text version of the .mdm file is stored in hsb.suffstat. To view it use an editor like pico or a pager like less for example
less hsb.suffstat
The pager named less is a UNIX program that displays text on the terminal screen one page at a time. Use the following keys to navigate through the text:
q: quit spacebar: Down one screen b: Back one screen j or down-arrow: Down one line k or up-arrow: Up one line /<string>: Search forward for <string> (replace <string> with the text you want to find) ?<string>: Search backwards for <string> (replace <string> with the text you want to find)
Or you can bypass creation of an output file by piping the output directly into the pager program
prssm2 hsb.mdm | less
(The vertical bar (|) is the pipe symbol.)
For the most part you can use these commands as you did version 5 commands. You can run interactively or with the command-line arguments indicating the name of your command files.
To proceed interactively using a .mdm file named hsb.mdm as input, type
hlm2 hsb.mdm
The program will use the default settings for analysis commands. These defaults are stored in /opt/hlm6/comfile2.hlm.
To proceed in batch mode using a .mdm file named hsb.mdm and a command file named hsb2.hlm, type
hlm2 hsb.mdm hsb2.hlm
Since a command file is specified here, the default file (/opt/hlm6/comfile2.hlm) is ignored. All information needed by the program can be placed in your command file. If you do not specify all the required information in your command file, the program may prompt you for the additional information.
Whether you run interactively or batch mode, the program produces two output files. One is called newcmd.hlm. This file echos the commands used for the analysis. The second file contains the statistical output. It's filename is the name you give to the prompt "Enter name of output file: " or enter in the command file after the OUTPUT: keyword, in this example, OUTPUT:newcmd.out.
A history of all iterations is printed to your screen. Selected iteration output is written to your output file. If you need all the iterations, you may redirect the screen output to a file. Be sure the file name is different than the name of your output file specified in the .hlm file. For example
hlm2 hsb.mdm hsb2.hlm > ! hsb2.iterations
Many sample programs and sample data are available at ftp://ftp.lisrel.com/hlm/. (These are HLM programs. Both LISREL and HLM are distributed by Scientific Software, Inc.)
The residual files produced by hlm2 are used to evaluate the fit of the model. You check the fit with software other than HLM. If you request a residual file, HLM produces a command file for reading the residual data into SAS© or SPSS.© or other statistical software. On UNIX, we recommend SAS. You then run SAS to analyze the residuals.
For example, to produce a SAS command file just for level-one variables in the HSB example, include commands like the following in your hsb2.hlm file:
RESFILTYPE:SAS RESFIL1:Y RESFIL1NAME:resfil1.sas RESFIL2:N
and do the HLM run batch mode. Here, the line RESFILTYPE:SAS indicates a SAS data set is requested. The line RESFIL1:Y requests a level-one residuals file, and RESFIL1NAME:resfil1.sas gives the name of the SAS command file. The line RESFIL2:N indicates no level-two residuals file is requested.
Next, to create a SAS system file, run SAS using the command file produced by HLM
SAS resfil1.sas
The SAS command file produced by HLM contains no analyses; it just produces a permanent SAS dataset. You decide what analyses to do and use the SAS dataset (resfil2.sas7bdat) as input. For example, the SAS command file residAnalysis1.sas produces descriptive statistics for all variables (proc means), runs the univariate procedure to test for normality of residuals and produce a histogram, Q-Q plot and probability plot, and plots level-one residuals (l1resid) against the predicted values (fitval). For comparison, at the bottom after the title statement (title "Generated data: Normal error";), it also generates data with normally-distributed residuals and carries out the same analysis as for the HSB data. Note: This example produces several high-resolution plots. Therefore, you must be connected to strauss with an emulation of an X-terminal like Exceed for it to work. Also, note on the Exceed web site a free X-terminal emulation named Cygwin.
If you need help quickly, you may call the IT Help Center at 831-6000 between 8 a.m. and 5 p.m., Monday through Friday. Or, you can submit a question through e-mail.