Multilevel Models Part 2: What is a Multilevel Model?

0
Multilevel models (also called hierarchical linear models) are used to analyze clustered or grouped data, as well as longitudinal or repeated measures data. Consider the simple scenario shown below, where Y is continuous and is shown as a function of a continuous predictor variable, X (which has been standardized). If we fit a simple linear regression model, we will be assuming independence of the observations.

Let's assume that these observations come from two clusters (groups) in our population. When we account for the clusters, the graph looks like this:

Now we can see that the observations are not independent, as we assumed. They are correlated, with all the observations from group 1 above the estimated regression line, and all the observations from group 2 below the estimated regression line.

A multilevel model would account for the correlations among the observations within each group and allow for separate lines to be estimated:

For this overly simple model with two groups, an ANCOVA model would be satisfactory. However, for a large number of groups (such as patients nested within hundreds of clinics, or perhaps customers nested within thousands of banking centers), a multilevel model is a parsimonious way to handle a large number of groups. As a bonus, if the groups can be envisioned as representing a larger population of such groups, the model can be generalized to the population. This means that even if only a sample of the clinics or banking centers is in your study, you can generalize your results to obtain estimated lines for all the groups in your population, including those that are not a part of your study.

Multilevel models can be fit in PROC MIXED (for continuous outcomes) or PROC GLIMMIX (for continuous or discrete outcomes).  The code below would fit the model illustrated above for a continuous outcome:
 

proc mixed data=data-set-name;
   model Y = X-standardized / solution ddfm=bw;
   random intercept X-standardized  / subject=group_id type=un;
   title 'Multilevel Model';
run;

Even though the lines seem parallel in the plot above, the model fit by this could code would allow for the estimation of separate slopes for each group.

For more on multilevel models, check out Part 1: Do I need a multilevel model?

We have courses available throughout the year and in June at our Analytics 2013 conference in London.

Share

About Author

Chris Daman

Sr Analytical Training Consultant

Chris Daman is a statistical training specialist and course developer in the Education Division at SAS. She has more than 20 years of teaching experience—both nationally and internationally—in the fields of programming, statistics, and mathematics. Before joining SAS in 2005, she taught classes at N.C. State University and IBM, worked in the pharmaceutical and financial industries, and was a survey statistician at an international research organization. She currently teaches advanced statistics courses covering mixed models, generalized linear mixed models, hierarchical linear models, and design of probability surveys; in addition, she teaches design of experiments and analysis of complex data, such as longitudinal data, multilevel data, or data from complex surveys. She also teaches data mining classes, including applied analytics and advanced decision trees. She has a bachelor's degree in mathematics from the University of North Carolina at Greensboro and a master's degree in statistics from N.C. State University. Chris's favorite part of teaching is the interaction with the students. To keep them involved with the material and each other, she often uses a variety of teaching techniques (such as analogies, optical illusions, stories, object lessons, and group interactions) rather than the standard instructor-to-student lecture format. As a result, students give high ratings to her classes and typically include comments such as "I enjoyed Chris's teaching style very much. She did an excellent job of engaging the class and fostering interactions between all the students and herself" or "I love Chris's sense of humor. It definitely helps you get through complicated material". In her spare time, Chris enjoys dancing, reading, spending time with her family, and traveling.

Comments are closed.

Back to Top