Page One

Campus Computing News

UNT Internet Service E-mail Upgrade News

Account Renewal Time

GroupWise "Everyone Mail" a Problem

Before You Make that Call

Help Wanted

Free Web Help

RSS Matters

The Network Connection

List of the Month

WWW@UNT.EDU

Short Courses

IRC News

Staff Activities

    

RSS Matters

By Craig Henderson, Research and Statistical Support Services

What is RSS Matters?

In February, 1999 we began a new series of articles. Each month, we will be discussing some advanced methods of data analysis and how they can be implemented in the software supported by the Research and Statistical Support office. Last month, Rich Herrington contributed an article on the new conjoint analysis module implemented in SPSS 9.0, SPSS Conjoint. In this month's article, I will discuss multilevel modeling using SAS Proc Mixed.

Multilevel Modeling

In a nutshell, multilevel modeling (also known as hierarchical linear modeling and random coefficient modeling), is a flexible data analysis technique that involves analyzing linear models (e.g., the general linear model used in conjunction with ANOVA and regression) with a hierarchically nested structure (Bryk & Raudenbush, 1992). It is actually an adjective used to refer to the mixed effects general linear model when applied to hierarchically nested data. The classic example is of students, nested within classrooms, nested within schools, nested within school districts, etc. Another frequently used application is the analysis of individual growth models designed for exploring longitudinal data (on individuals) over time. Basically, multilevel modeling models expand traditional regression methods by dropping the assumption of independence of observations and allowing the researcher to estimate both fixed and random effects on more than one level of a hierarchical structure simultaneously. Relationships are no longer assumed to be fixed over contexts (e.g., schools, time) and therefore are allowed to differ. These models are more realistic than traditional regression models due to making less restrictive assumptions; however, as Kreft (1996) points out, this generality is not without its price. Multilevel modeling models are not parsimonious, as more parameters are estimated, the outcomes may be more sample specific, larger data sets are needed for stable solutions, and they use more complex estimation methods than the ordinary least squares method applied in traditional linear regression. 

Although multilevel models are not a panacea, finally giving researchers THE statistical technique that will generate theory for you, there are several reasons that multilevel modeling is something that researchers in the social sciences need to know. First, there is the problem of nonindependence of observations. Basically, this problem involves a situation in which clusters of individuals in an analysis have more in common with each other than other individuals. Situations in which this would be obvious are students in the same classroom, and family members in the same family. If traditional methods are used in these cases, standard errors will be underestimated, leading to an increased probability of a Type I error. However, other problematic situations are less obvious. The intraclass correlation is a helpful diagnostic tool in determining if a multilevel modeling will be superior to a traditional method, such as regression or ANOVA. A rough rule of thumb is when the intraclass correlation is over .10, hidden clusters are present in your data, and a multilevel modeling model would be a more appropriate data analysis technique.

Second, in the absence of intraclass correlation, there is no improvement of multilevel modeling over traditional models in terms of estimating fixed effects (Kreft, 1996). However, this is not the case if the researcher is interested in estimating random effects, particularly random regression coefficients. To illustrate this point, a multilevel model involves the following equations:

Yij = aj + bjXij + eij  (1)
aj = g00 + g01Zj + u0j     (2)
bj = g10 + g11Zj + u1j    (3)

where underlining indicates a random variable, X is a single predictor, and Y is the dependent variable.  Index i is used for individuals, and index j is used for contexts. The error terms u0j and u1j indicate that the intercept aj and the slope bj will vary over contexts. g00 indicates the grand mean, while u0j measures the deviation in means across contexts from the grand mean. Likewise, g10 represents the grand regression slope across contexts and u1j the deviation in slopes from the grand slope across contexts. The equations for aj and bj include a fixed component, g00 and g10, and a random component, u0j and u1j. u0j has a variance, t00, u1j has a variance t11, and u0j and u1j have a covariance, t01. Zj represents a contextual level
variable (e.g., school, person in the case of repeated measurements); therefore, equation (2) demonstrates that the intercept (mean) of each context is a function of the group level variable and random fluctuation.  In equation (3), the slope is a function of the same group level variable and random fluctuation. The variances of u0j and u1j and their covariance are parameters estimated in the model, and are found in the matrix T, which has the following structure:

     t_matrix.jpg (2420 bytes)

In traditional regression, a and b are treated as fixed effects, and the random fluctuations are not estimated.  Why is this important? By estimating the elements in the T matrix, we can examine the unique estimates for separate contexts more efficiently than by conducting separate regression equations for each context.   Furthermore, we can now examine cross level interactions. An example would be the literature on aptitude by treatment interaction literature in education. Such research operates on the theory that teacher styles differ, and that some styles are more effective for certain students than for others. Instead of asking the question, what teaching methods are most effective, the more useful question of what teaching methods are most effective, for which students, in which contexts?

Multilevel Modeling in SAS PROC MIXED

In 1992 SAS introduced the PROC MIXED routine into their statistical package. It was written by agricultural and physical scientists seeking to generalize the standard linear model to incorporate both fixed and random effects and therefore did not have the needs of social scientists in mind. However, by correctly specifying the mixed model, a researcher can fit multilevel models and individual growth curve models that have become quite popular in the social sciences (Singer, 1997). The material for this paper is provided by Singer (1997), and interested readers should study her very informative, understandable article. Using her examples, I will provide demonstrations of how to fit a "school effects" model (a model in which students are nested within schools), which is basically a cross-sectional multilevel model, used when intraclass correlation in present.  Next month, I will provide an example with a longitudinal growth curve model.  These examples are also provided by Bryk and Raudenbush (1992).

School Effects Model

This example uses data originally analyzed by Bryk and Raudenbush (1992). The data set contains information gathered from 7,185 students in 160 schools. The student-level (level-1) outcome variable is mathematics achievement. There is one student-level (level-1) covariate, SES and two school-level (level-2) covariates, average SES for school and sector. Analysis of multilevel models typically begins with an unconditional means model, in which the outcome variable is modeled as a linear combination of the grand mean, deviations from that mean, and random error. This is basically a one-way random effects ANOVA model.

Unconditional Means Model

The equations for the unconditional means model are as follows: At level 1, math achievement is modeled as the sum of an intercept (mean) for the students school (b0j) and a random error (rij) associated with the ith student in the jth school:

Yij=b0j + rij where rij ~ N(0,s2) (2a)

At level 2 (the school level), the school level intercepts are expressed as a linear combination of an overall mean (g00) and a series of random deviations from that mean (u0j):

b0j=g00 + u0j where u0j ~ N(0,t00) (2b)

Substituting (2b) into (2a) yields the multilevel model:

Yij=g00 + u0j + rij where u0j ~ N(0,t00) and rij ~ N(0,s2) (3)

This model can be partitioned into the fixed effect, g00 (which tells about the average math achievement score in the population), and two random effects, u0j (for the intercept) and (for the within school residual) rij.  Both u0j and rij have variance components, t00 and s2 respectively. t00 tells us about the variability in the school means and s2 tells us about the variability of mathematics achievement within schools.  The SAS syntax used to generate this model is as follows:

proc mixed noclprint covtest;
  class school;
  model mathach = /solution;
  random intercept/sub=school;

The CLASS statement identifies the categorical variable, in this case, school. In PROC MIXED, the MODEL statement specifies the fixed effects, and the RANDOM statement the random effects. The NOCLPRINT option prevents the printing of all CLASS level information. The COVTEST option tells SAS that you would like to run hypothesis tests on the variance and covariance components in your model.  In this example, the MODEL statement appears that the dependent variable MATHACH has no predictors.  In actuality, there is an implied predictor, a vector of 1's that represents the intercept.  The /SOLUTION option asks SAS to print estimates for the fixed effects.

The RANDOM statement is the most critical and trickiest part about fitting multilevel models. There is always one random effect, the level-1 within group residual (rij).  In the syntax above, we are also specifying a second random effect, that in addition to being a fixed effect, the intercept should be treated as a random effect (t00) in equation (3). "The SUB= option specifies the multilevel structure, indicating how the level-1 units are divided into level-2 units" (Singer, 1997, p. 7). In this example, the SUB= option is indicating that individuals are nested within schools. I will refer you to Singer (1997) to for the output and interpretation of this model.

Including Effects of Level-2 Predictors

In multilevel modeling, an unconditional means model is usually fitted first to provide a baseline against which more complex models can be compared. In this example, I will demonstrate how to add level-2 (school-level) predictors. Again following Singer (1997), an average SES of children within a school (MEANSES) is added as a level-2 predictor. This predictor is centered about the grand mean, which facilitates the interpretation of the intercept term, g00. The equation for fitting this model is included below:

Yij=b0j + rij     and    b0j=g00 + g01MEANSESj + u0j    where rij ~ N(0,s2) and u0j ~ N(0,t00) (4)

Substitution yields the following:

Yij=[g00 + g01MEANSESj] + [u0j + rij] (5)

In this example, the fixed and random effects are separated by brackets.

The SAS syntax to generate the following model is included below:

proc mixed noclprint covtest;
  class school;
  model mathach = meanses/solution ddfm=bw;
  random intercept/sub=school;

In this example, we have added the fixed effect MEANSES to the MODEL statement. Other level-2 predictors can be added as well, as is appropriate for your analysis.  The option /DDFM=BW tells SAS to use the between/within method for computing the denominator degrees of freedom for fixed effect hypothesis tests.

Including Effects of Level-1 Predictors

The following example will demonstrate adding level-1 predictors to the school-effects model. The level-1 predictor used in this example is the SES of the individual students (as opposed to the MEANSES level-2 variable used in the previous example). 

The equations to fit this model are included below:

Yij=b0j + b1jSESij + rij (6)    

b0j=g00 + u0j (6a)    

b1j=g10 + u1j (6b)    

where rij ~ N(0,s2) and

equation.jpg (5236 bytes)

By adding the fixed effect for student SES, we have now interjected another random effect in our model.  That is, not only are we stating that a student's mathematics achievement is related to his/her SES but this relationship can vary across schools. Equations (6a) and (6b) indicate that both intercepts (b0j) and slopes (b1j) can vary across schools; therefore, a variance component can be estimated for the intercepts, the slopes, and a covariance component can be estimated, representing the correlation between intercepts and slopes. These variances and covariances are represented in the T matrix,

t_matrix.jpg (2420 bytes)

The SAS code to fit this model is included below:

proc mixed noclprint covtest;
  class school;
  model mathach = ses/solution ddfm=bw notest;
  random intercept ses/sub=school type=un;

The MODEL statement includes a fixed effect for SES. The RANDOM statement includes two random effects, one for the intercept, and one for the SES slope. The TYPE=UN option specifies that the variance-covariance matrix for the intercepts and slopes (the T matrix) should be unstructured.

Including Both Level-1 and Level-2 Predictors

In many models, researchers will want to include both level-1 and level-2 predictors. In the following example, we will fit a model with student SES (a level-1 predictor) and school SES and school sector as level-2 predictors. The equations for this model are found below:

Yij=b0j + b1jSESij + rij (7)

b0j=g00 + g01MEANSESj + g02SECTORj + u0j (7a)

b1j=g10 + g11MEANSESj + g12SECTORj + u1j (7b)

where rij ~ N(0,s2) and

equation.jpg (5236 bytes)

This model is very similar to that fit with equations (6) - (6b), only including fixed effects for MEANSES and SECTOR. The number of random effects stays the same.  Fitting this model involves the following SAS syntax:

proc mixed noclprint covtest;
  class school;
  model mathach=meanses sector ses meanses*ses sector*ses/
                            solution ddfm=bw notest;
  random intercept ses/type=un sub=school;

As can be seen in the example above, this model merely involves expanding SAS syntax we have covered previously.

Next month, I will include an article on fitting longitudinal growth-curve models with SAS. I hope you find these exercises helpful in your research. Please feel free to contact me with any suggestions, comments, or questions, craigh@unt.edu.  Enjoy!!!

References

Bryk, A. S., & Raudenbush, S. W.  Hierarchical linear models.  Newbury Park, CA: Sage Publications.
 
Kreft, I. G. G.  (1996).  Are multilevel techniques necessary?  An overview including simulation studies. Multilevel Models Project.  http://www.ioe.ac.uk:80/multilevel/workpap.html.
 
Singer, J. D.  (1997).  Using proc mixed to fit multilevel models, hierarchical models, and individual growth models. The Journal of Educational and Behavioral Statistics, in press.