The HPLMIXED Procedure

Mixed Model Analysis of Covariance with Many Groups

(View the complete code for this example.)

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 nthreads=4;
   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 54.1.

Figure 54.1: Mixed Model Analysis of Covariance

Performance Information
Host Node<< your grid host >>
Install Location<< your grid install location >>
Execution ModeDistributed
Number of Compute Nodes20
Number of Threads per Node4

Data Access Information
DataEngineRolePath
WORK.SCHOOLSAMPLEV9InputFrom Client

Model Information
Data SetWORK.SCHOOLSAMPLE
Dependent VariableMath
Covariance StructureUnstructured
Subject EffectNeighborho(SchoolID)
Estimation MethodRestricted Maximum Likelihood
Residual Variance MethodProfile
Fixed Effects SE MethodModel-Based
Degrees of Freedom MethodResidual

Class Level Information
ClassLevelsValues
Neighborhood15201 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...
SchoolID3001 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...

Dimensions
Covariance Parameters7
Columns in X3
Columns in Z per Subject3
Subjects7500
Max Obs per Subject8

Number of Observations Read60000
Number of Observations Used60000
Number of Observations Not Used0

Optimization Information
Optimization TechniqueNewton-Raphson with Ridging
Parameters in Optimization6
Lower Boundaries3
Upper Boundaries0
Starting Values FromData

Iteration History
IterationEvaluationsObjective
Function
ChangeMax Gradient
02225641.67142 3.369E-8

Convergence criterion (ABSGCONV=0.00001) satisfied.

Covariance Parameter Estimates
Cov ParmSubjectEstimate
UN(1,1)Neighborho(SchoolID)2.0902
UN(2,1)Neighborho(SchoolID)0.000349
UN(2,2)Neighborho(SchoolID)2.0517
UN(3,1)Neighborho(SchoolID)0.01448
UN(3,2)Neighborho(SchoolID)0.01599
UN(3,3)Neighborho(SchoolID)0.08047
Residual 1.0083

Fit Statistics
-2 Res Log Likelihood225642
AIC (Smaller is Better)225656
AICC (Smaller is Better)225656
BIC (Smaller is Better)225704

Solution for Fixed Effects
EffectEstimateStandard
Error
DFt ValuePr > |t|
Intercept2.50700.028286E488.66<.0001
Time2.51240.026596E494.48<.0001
Time*Time0.50100.0052476E495.48<.0001