HLM equation and PROC MIXED/GLIMMIX syntax

level1 : y= b0 + b1*X + error1
level2: b0=g00 + g01*group+error2
level2: b1=g10 + g11*group + error3

I insert level2 equations into level 1.

level1 : y= g00 + g01*group+error 1+ (g10 + g11*group + error2)*X + error3

level1 : y= g00 + g01*group+error 1+ g10*X + g11*group *X + error2*X + error3

This translates into PROC MIXED syntax in this way.  Independent variables that are right next to the error (error2*X) goes into the random statement.

proc mixed ;
class sub group ;
model y=x group x*group;
random intercept x;
run;

Leave a Reply