College of Natural Sciences
 
FAQs
This is for IE7 to hold div open

HLM FAQ #3: Level-1 Regression Equations

Question:

I have a two-level model in which students are nested within schools. I would like to see the empirical Bayes level-1 regression equations for each school. Does HLM provide this output?

Answer:

HLM output does not include the empirical Bayes parameters for the individual level-2 units. However, it is possible to create a residual file that contains the difference between the average level-1 parameters and each school's parameters. The residual file that is created is not actually a data file, rather it is a syntax file for one of three possible software packages (SPSS, SAS, or SYSTAT). Using one of these programs, the syntax file can be run to put the data into a data file which can then be analyzed or used to compute new variables. The file contains both the ordinary least squares (OLS) residuals and empirical Bayes residuals.

To obtain this file, go to Basic Specifications on the menu to open the Basic Model Specifications dialog box. Click Create Residual File, which will open the Create Residual File dialog box. Click the radio button next to the type of file that you would like to create. In the current example, an SPSS file is created. You can also assign a file name other than the default name, resfil. The file will be saved to the same directory as your output file, which is indicated in the Basic Model Specifications dialog box.

The present example uses the hsb.ssm dataset that can be found in the HLM Examples directory. The level-1 model contains a random slope for the independent variable, ses, and a random intercept. The model is shown below:

Random Slope and Intercept Model

Running the above model with the option to create a residual file produces an SPSS syntax file that can be opened in the SPSS Syntax Editor. The first several lines are shown below:

DATA LIST FIXED RECORDS = 6
 /1 ID NJ CHIPCT MDIST LNTOTVAR OLSRSVAR MDRSVAR (A12,F5,5F11.5)
 /2 EBINTRCP EBSES    (2F11.5)
 /3 OLINTRCP OLSES    (2F11.5)
 /4 FVINTRCP,FVSES   ,(2F11.5)
 /5 PV00 PV10 PV11 (3F11.5)
 /6     SIZE   SECTOR   PRACAD  DISCLIM  HIMINTY  MEANSES ( 6F11.5).
BEGIN DATA
        1224   47    0.59435    0.63022    2.02739    2.01643    2.00550
   -1.60474    0.11084
   -1.85980    0.11470
   12.66493    2.39388
   0.735079   0.104732   0.334263
  842.00000    0.00000    0.35000    1.59700    0.00000   -0.42800
        1288   25    0.20625    0.24837    1.94945    1.92016    1.90261
    0.40859    0.08532
    0.45000    0.86157
   12.66493    2.39388
   1.158870  -0.067171   0.371764
 1855.00000    0.00000    0.27000    0.17400    0.00000    0.12800

The syntax that is created can be used to create an SPSS dataset. To do this, first open the file in the SPSS Syntax Editor, then submit the syntax using the following menu items:

    Run
        All

This will read the data contained in the syntax file into the SPSS Data Editor. Once the data is in the Data Editor, the level-1 regression equation can be computed. The data produced by the syntax shown will appear as follows in the SPSS Data Editor:

HLM Residual File

Each row represents a level-2 unit in the residual file, so in this file, each row represents a school. The variables that are used for computing the level-1 slopes and intercepts for individual schools are ebintrcp, ebses, olintrcp, olses, fvintrcp, and fvses. The ordinary least squares residuals are prefixed with ol and the empirical Bayes parameters are prefixed with eb. For example, the OLS intercept has the name, olintrcp, and the slope for the variable ses has the name olses. The OLS regression parameters are represented as differences from the average parameters. For example, the Empirical Bayes intercept, ebintrcp, for school ID 1224 is -1.6 units smaller than the average intercept.

The average intercept and slope are prefixed with fv, where the slope is fvintrcp, and the ses intercept is fvses. These values are the values in the Final estimation of fixed effects table in the HLM output. The OLS and empirical Bayes intercepts and slopes for level-1 units are computed in the same manner: the average intercept and slopes (fvintrcp and fvses) are added to the residuals to obtain the level-1 parameter values. Each parameter is computed separately using a COMPUTE statement in SPSS. The COMPUTE statement contains the name of the new variable on the left side of the equation and the numerical formula on the right side of the formula. For example, to create a new variable named eb_int, which is a level-1 empirical Bayes intercept, you would use the following syntax:

COMPUTE eb_int = fvintrcp + ebintrcp .
EXECUTE .

In this example, eb_int is the new variable which takes the value of the average intercept, fvintrcp, and the empirical Bayes residual, ebintrcp, from the grand intercept. The code above can be executed in the Syntax Editor using the same process that was described earlier for reading in the syntax. After executing the syntax, the new variable will appear in the rightmost column of the Data Editor.

If you have further questions, send E-mail to stats@ssc.utexas.edu.