Suppose you are an educational researcher who studies how student scores on math tests change over time. Students are tested four times, and you want to estimate the overall rise or fall, accounting for correlation between test response behaviors of students in the same neighborhood and school. One way to model this correlation is by using a random-effects analysis of covariance, where the scores for students from the same neighborhood and school are all assumed to share the same quadratic mean test response function, the parameters of this response function being random. The following statements simulate a data set with this structure:
data SchoolSample; do SchoolID = 1 to 300; do nID = 1 to 25; Neighborhood = (SchoolID-1)*5 + nId; bInt = 5*ranuni(1); bTime = 5*ranuni(1); bTime2 = ranuni(1); do sID = 1 to 2; do Time = 1 to 4; Math = bInt + bTime*Time + bTime2*Time*Time + rannor(2); output; end; end; end; end; run;
In this data, there are 300 schools and about 1,500 neighborhoods; neighborhoods are associated with more than one school and vice versa. The following statements use PROC HPLMIXED to fit a mixed analysis of covariance model to this data. To run these statements successfully, you need to set the macro variables GRIDHOST and GRIDINSTALLLOC to resolve to appropriate values, or you can replace the references to macro variables with appropriate values.
proc hplmixed data=SchoolSample; performance host="&GRIDHOST" install="&GRIDINSTALLLOC" nodes=20; class Neighborhood SchoolID; model Math = Time Time*Time / solution; random int Time Time*Time / sub=Neighborhood(SchoolID) type=un; run;
This model fits a quadratic mean response model with an unstructured covariance matrix to model the covariance between the random parameters of the response model. With 7,500 neighborhood/school combinations, this model can be computationally daunting to fit, but PROC HPLMIXED finishes quickly and displays the results shown in Figure 8.1.