Multilevel Analysis/Hierarchical Linear Modeling
Edpsych/Psych/Stat 587
C.J. Anderson
Fall 2015
Last revised: December 2, 2015
General Information
Announcements
Lecture notes
Computer Lab
Homework
Examples of Papers that Use Multilevel Models
Example analyses
Handy program and links
Questions or problems regarding this site should be sent to
cja@illinois.edu.
General Information (MSword format):
Announcements:
 Links to software and rescourse for computing power and deciding on sample size:
 Optimal Design Software Program and documenation from Raudenbush group. (PC only)
 PINT Program and documentation from Snijders. (PC only)
 Xiaofeng Steven Liu (2014). Statistical Power Analysis for the Social and Behavioral Sciences: Basic and Advanced Techinques.
Routledge: NY. This book contains explanation of procedures and code for R, SAS and SPSS. If you search google scholar
for "Xiaofeng Liu power hlm", you will find some of his papers on power and HLM (He was a student of Raudenbush).
 Nov 12:
 SAS from lab sessions are posted below.
 Two changes (additions to the lab instructions:
 Before you run PROC REG, add the line "ods graphics off". PROC REG will produce graphs,
which take a long time, espeically since it is doing regression of each cluster (school).
Without this line, it could take half to a full hour to run.
 To have SAS put the graphs produced in a convienent location and name, add the line
before the procedure for the graph (e.g., PROC SGPANEL or SGPLOT):
"ods rtf file="C:\Users\cja\figurex.rtf". Include path to the folder and the name you
want to give the graph.
 Nov 3:
 Answer key 4 is posted.
 Computer lab 4 and data are posted. The lab will be Thursday November 5.
 Homework 5 is posted (the last one).
 The final exam is posted below (after homework 5).
 Sept 17: due date for Homework 2 changes to Thursday Sept 24.
 Thursday Aug 3: Homework was assigned in class and is due on Tuesday. The assignment is
here and below.
 Friday Aug The introduction to SAS computer lab, which is entirely optional, will be held xxxxx. The materials that we will cover are online
 For those who might want to use Bayesian estimation, I worked up a small example for the empty model, random intercept with one predictor, and a random
intercept and slope model. I also included proc mixed code if you want to compare results. You can change the seed to "1" and run the mcmc code a few times and
compare results.
 Draft chapters on GLM, GLMM, and LLM (i.e., HLM).
 Computing: We will be running statistical software (SAS) using remote desktop to a university server. Here are the instructions:
remote desktop connection. Here is the file referred to in the instructions as an RDP file. 
Use "Save link as" when you download the RDP file and save it to a convient location (e.g., desktop).
When you run the RDP application and it will run remote desktop application and set up configurations such that you will be able to directly open and save files from the remote server to your computer (and visa versa).
If you don't want to do these things, just use your remote desktop program and enter "remote2.webstore.illinois.edu".
There are 2 things that you need before you can do this:
 Your computer must be hooked up to the internet. If you access the internet via campus wireless, home, hotel, Espresso Royal, or elsewhere), you will need
to use VPN (Virtual Private Networking) to securely connect to the campus internet.
 You must be registered for the class. If you reccently registered, you may not yet have permission to login yet.
Lectures Notes:
 Introduction.
SAS programs that generated (most of) the
statistics and graphs in the lecture notes:
 Models for clustered data: Fixed and random
effects ANOVA and multiple regression. SAS code that
produced statistics and graphics given in lecture note
 Optional: Introduction to SAS to be held in rm 22 Education bldg on Tue Sept 2, 1112.
 Random Intercept Models.
 ANCOVA.sas.
Fits ANCOVA model to NELS88, N=10 data (includes centering a variable, model
fitting using GLM, and SAS/GRAPH of model).
 hsb1.sas.
Creates SAS data set of level 1 data for the High School and Beyond data.
 hsb2.sas.
Creates SAS data set of level 2 data for the High School and Beyond data.
 hsball.sas.
Merges level 1 and level 2 high school and beyond sas datasets.
 betwithin.sas.
SAS/GRAPHS for looking between and within variability of SES in the high
school and beyond data.
 randomintercepts.sas.
SAS PROC MIXED and fitting random intercept models (includes centering SES)...and some graphics.
 SAS for HLM.
These will be used in lecture (they can also be used to reproduce the models for HSB data in
the lecture notes on random intercept models):
This is from the introduction to SAS session:
 Random Intercept and Slopes Models .
 Estimation of Marginal Model .
 Statistical Inference: Marginal Model.
 Random Effects.
 Model Building. (revision complete)
Computer Lab Sessions: Bring laptop
 Computer Lab Session 0 (optional): Introduction to SAS
 Computer Lab Session 1: (bring laptop) Thursday September 10, 2015
 Computer Lab Session 2: (bring laptop) Tuesday September 28, 2015
 Computer Lab Session 3: bring laptop. Thursday October 15, 2015
 Computer Lab Session 4: bring laptop. Thursday November 5, 2015
Homework
 Homwork 1:
 Homework Number 2: NEW DUE DATE: Thursday Sept 24.
 Homework Number 3
 Homework Number 4:
 Homework Number 5:
 Final Exam and Projects: Hardcopy is due due Thursday Dec 10, 2015 by 3:30pm (offices are locked around 4:00pm).
Pentalty for late finals or projects is 10 points (out of 100 points) per weekday
(e.g., turn in Friday, 10 point deduction; turn in Monday 20 point, etc).
Examples of Papers that Use Multilevel Models
 Payne, B.R., Gao, X., Noh, S.R., Anderson, C.J., StineMorrow, E.A.L. (2011). The effects of print
exposure on sentence processing and memory in older adulats: Evidence for efficiency and reserve. Aging, Neuropsychology, and Cognition.
Some examples of crossed random effects, skewed responses (i.e., reaction times), and discrete response (i.e., Poisson).
 Segerstrom, S.C. & Sephton, S.E. (2010). Optimistic expectanices and cellmediated immunity: The role
of positive affect. Psychological Science, 21, 448455.
Example of where cluster centered level one variable is substantive (theoretical) interest. The response variable is numerical/continuous.
 Allen, N.E., Todd, N.R., Anderson, C.J., Davis, S.M., Javdani, Bruehler, V., & Dorsey, H.
(2013). CouncilBased approaches to intimate partner violence: Evidence for distal change in system response. American Journal of Community
Psychology, 52, 112.
Example of a longitudinal study with creative centering of time. The response variable was a rate (probability).
 Poteat, V.P. & Anderson, C.J. (2012). Developmental changes in sexual prejudice from early to late
adolescence: The effects of gener, race, and ideology on different patterns of change. Developmental Psychology, 48, 14031415.
Example of an accelerated longitudinal design.
 Examples from Tom Snijders course webpage where multilevel models have been used. (click on "info course multilevel" on left and go to
bottom of page. These papers cover a range of topics (e.g., political science, sociology, school psychology, criminology, medicine, and others).
Example SAS Programs (ascii/text format):
Examples from Snijders & Bosker using SAS
 MLbook.sas.
Create SAS data for examples in Chapters 4 and 5.
 Ch4_examples.sas.
Example 2level analyses from Chapter 4 (random intercept models).
 Ch5_examples.sas.
Example 2level analyses from Chapter 5 (random intercept and
slopes).
 Ch12_examples.sas.
Examples analyses from Chapter 12 (longitudinal data analysis),
including creating sas dataset.

Examples from Chapter 4 of Kreft & de Leeuw (provided and written
by Carol Nickerson):

School23.sas.
SAS code that creates data set and fits models reported in Kreft &
de Leeuw.

school23.dat.
Raw data file that is used as input to school23.sas.
Handy Programs and Links:

Ones specific to multilevel modeling:

General ones:

CIforP.f:
A FORTRAN program that computes large sample confidence intervals for a
proportion.

pvalue.f:
A FORTRAN program that computes pvalues and (bonferroni) critical values
for the standard normal, chisquared, t, and F distributions (and for correlations).
For users of PC type computers,
pvalue.exe
is an executable (i.e. already compiled) program.