Random effects specifications in PROC MIXED


Consider the following PROC MIXED model:

   proc mixed;
      class state;
      model y=x;
      random state;
   run;

To add a random slope component for X across the levels of STATE to this model, the code becomes this:

   proc mixed;
      class state;
      model y=x;
      random state x*state;
   run;

However, you can write that RANDOM statement more efficiently this way:

   proc mixed;
      class state;
      model y=x;
      random int x / subject=state;
   run;

If there is a common effect in all random terms in your RANDOM statement, such as STATE above, you can "factor out" that common effect and use it in the SUBJECT= effect in the RANDOM statement. Where the common effect appears by itself in the original RANDOM statement, replace it with INT.

The RANDOM statements in the two models above are equivalent in terms of expressing the model. However, the RANDOM statement in the second model has an advantage. This RANDOM statement blocks the design matrix (known as G) for the random effects. This blocking allows PROC MIXED to use less memory in estimating the model as well as to run faster.

Looking at the RANDOM statement in the second model, you might be confused about the role of X. Is X a fixed or random effect? STATE is a random effect and the interaction of X and STATE is a random effect, but X is still a fixed effect. The new syntax does not change the role of the effects in the model. Even though X appears by itself in the RANDOM statement, the SUBJECT= effect means that X really represents the X*STATE interaction.

Please note that the second model is often referred to as a random coefficients model. One of the common specifications is to use TYPE=UN to model the covariance among the intercept and slope for each subject. Such models can only be specified with the SUBJECT= option as in the second model. There is no way to write an equivalent model using the first specification in this case.