CJ 605 Spring 04 Advanced Statistics in Criminal Justice:

Miscellaneous advice pieces


Starting up HLM

Starting up HLM: an expanded version

Suggestions for introduction
Suggestions for Research Methods Section
 
 
 


 

STARTING UP HLM - THE DIFFERENT PIECES

WHAT YOU NEED TO GET STARTED:
- Level 1 data file, sorted by your grouping variable (also called ID variable)
- Level 2 data file, sorted similarly
- it is absolutely CRUCIAL that your ID variable have the same format in both files, otherwise it will not be possible to put things together

WHAT YOU WILL CREATE
- SSM file (sufficient statistics matrix)
- Response file (*.RSP)
- Statistics about the SSM (an STS file)

The level 1 data file
* sorted by ID variable
* ID variable must be alphanumeric
* not allowed any missing data when we get to the generalized model for dichotomous or poisson-distributed outcomes; if you have missing data now you want deletion to be pairwise rather than listwise
* may or may not have a weighting variable
* format: SPSS or SYSTAT; if you are working with the student version of HLM your file must be in SYSTAT format ALREADY before you start your work at home. The program TRANSYS available on the department computers makes those translations for you (see below on making the translation)
* what it will do when there is no variance on a variable that is being used to construct the SSM at Level I. If you have a Level 1 variable where there is no variance within one or more of your groups (i.e., a neighborhood where all residents are white), you need to decide how to deal with that. Your options are:
   - drop the variable
   - randomly change at least 2 cases within the group
We will talk about the pros and cons of each

The level 2 data file
* sorted by ID variable
* need all of the Level 1 ID variables represented
* ID variable must be alphanumeric
* in Level 1 and Level 2 file the n of columns and column format must be identical for ID variable. I guarantee this will hang you up when you are creating your own files so pay attention here.
* NO missing data are allowed at Level 2

The location of the files
Although it does not matter now, when we get to the nonlinear models (also called generalized HLM), HLM will want to go back and read the individual level data file. Therefore it is essential that you always keep the original Level 1 file from which you created your SSM, and your SSM file, in exactly the same directories where they were originally created. This will save you a lot of grief and wasted time later on.

Doing it

Start up HLM. Go to SSM, go to FILE, go to NEW and you are off and running.
What needs to be specified:
- name and location of Level 1 file
- click on specific variables to be included
- one will be an ID variable
- name and location of Level 2 file
- click on specific variables to be included
- one will be an ID variable
- name of SSM file (*.ssm)
- name of response file (*.rsp)

What you will create

- you will create a sufficient statistics matrix (SSM) that has all the information you need for the linear models (binary file - you can translate it to ascii in the dos version of the program if you need to look at it)

- you will create some statistics about the SSM file (HLM2ssm.sts). This is an extremely important file and you need to look at it to be sure your number of cases are ok and your descriptive information for your variables makes sense. (ascii file)

- a response file (response.rsp) - this is just the command file HLM generated to do your work. You must name this and save it before creating the SSM.

 


STARTING UP HLM - THE EXPANDED VERSION

NOTE: THE ARROW SIGN COMES UP AS 

CJ 605 SP 04 2-2-04
RUNNING HLM ANOVA

Before you start:
1.	Know where your Level 1 and Level 2 SPSS data files are; be sure the ID variable has the same format in each file; be sure each file is sorted the same way on the ID variable. In our case the ID variable is NBH.

Starting: Making the SSM file (sufficient statistics matrix)
2.	Start HLM
3.	 File  SSM  New  Stat package input  “ok” for HLM2
4.	“Make SSM” page comes up
5.	Select approp. input file type -- SPSS
6.	create an ssm name e.g., phila_aa.ssm
7.	“Browse” for your L1 file
8.	Click on CHOOSE VARIABLES
9.	IN YOUR L1 file select NBH as the ID variable
10.	Put in other variables by clicking on SSM; pick just a few, but be sure to include your outcome; also be sure to include your weighting variable HSEBALWT
11.	When done click OK.
12.	Specify the weighting variable; say YES weights are  normalized; say level of generalization is LEVEL 1
13.	BROWSE and pick your L2 file then go to CHOOSE VARIABLES; be sure to click on NBH as your ID variable. REMEMBER: you can have NO missing data in any L2 selected variables
14.	When done click OK.
15.	To SAVE these commands click on SAVE RESPONSE FILE.  By doing this, you save all of your setup commands. If you make a mistake setting up your SSM file, you can “Browse” for your response file, pull it up, and it remembers everything you already told it!
16.	Click on MAKE SSM. DOS box should open. Stuff should happen.
17.	Click on CHECK STATS. You need to check these to be sure:  you have the appropriate n of Level 2 units, your minima and maxima are correct, and the like. This file is saved as HLM2SSM.STS. You want to print this out and go over it VERY CAREFULLY. When you print it out, put info on it so you know which ssm file it goes with.
18.	Click DONE

Creating the run commands and making it work
19.	Your variables should appear in the column at left. If you entered some L2 variables, you can toggle back and forth between the list of L1 and L2 variables.
20.	Click on your dependent variable. You have no other option than to click on outcome variable. Do it. Now your model comes up.
21.	Click on basic specifications and give your output a descriptive title e.g., “ANOVA for HEALTHA 02022004 try 31”
22.	Change the output file name; you will need to give it a directory; you CAN put it on C but ONLY in the TEMP directory; suggest you direct everything to ZIP. Output files always end in 
	 .out
23.	Now you must save  the command file. Go to File  Save as and give it a name ending in   
      .hlm  -- again, suggest you save to the zip disk
24.	Click on Run analysis. Stuff happens.
25.	Click on  File  View output. Your output file comes up in notepad. Scroll all the way through it to see that there was no premature end. You will want to print this out. But before you do I strongly suggest you open it in WORD and add page numbers and your name as a header so you know whose it is when the printer spits it out.

Suggestions for your introduction.


SUGGESTIONS FOR YOUR RESEARCH METHODS SECTION