The HPMIXED Procedure

Example 56.5 Repeated Measures

(View the complete code for this example.)

The following data are from Pothoff and Roy (1964) and consist of growth measurements for 11 girls and 16 boys at ages 8, 10, 12, and 14. Some of the observations are suspect (for example, the third observation for person 20); however, all of the data are used here for comparison purposes.

The analysis strategy employs a linear growth curve model for the boys and girls in addition to a variance-covariance model that incorporates correlations for all of the observations that arise from the same person. The PROC HPMIXED statements to fit an unstructured variance matrix are as follows:

data pr;
   input Person Gender $ y1 y2 y3 y4;
   y=y1; Time=1; Age=8;  output;
   y=y2; Time=2; Age=10; output;
   y=y3; Time=3; Age=12; output;
   y=y4; Time=4; Age=14; output;
   drop y1-y4;
   datalines;
 1   F   21.0    20.0    21.5    23.0
 2   F   21.0    21.5    24.0    25.5
 3   F   20.5    24.0    24.5    26.0
 4   F   23.5    24.5    25.0    26.5
 5   F   21.5    23.0    22.5    23.5
 6   F   20.0    21.0    21.0    22.5
 7   F   21.5    22.5    23.0    25.0
 8   F   23.0    23.0    23.5    24.0
 9   F   20.0    21.0    22.0    21.5
10   F   16.5    19.0    19.0    19.5
11   F   24.5    25.0    28.0    28.0
12   M   26.0    25.0    29.0    31.0
13   M   21.5    22.5    23.0    26.5
14   M   23.0    22.5    24.0    27.5
15   M   25.5    27.5    26.5    27.0
16   M   20.0    23.5    22.5    26.0
17   M   24.5    25.5    27.0    28.5
18   M   22.0    22.0    24.5    26.5
19   M   24.0    21.5    24.5    25.5
20   M   23.0    20.5    31.0    26.0
21   M   27.5    28.0    31.0    31.5
22   M   23.0    23.0    23.5    25.0
23   M   21.5    23.5    24.0    28.0
24   M   17.0    24.5    26.0    29.5
25   M   22.5    25.5    25.5    26.0
26   M   23.0    24.5    26.0    30.0
27   M   22.0    21.5    23.5    25.0
;
proc hpmixed data=pr;
   class Person Gender Time;
   model y = Gender Age Gender*Age;
   test Gender Age Gender*Age;
   repeated Time / type=un subject=Person r;
run;

The MODEL statement first lists the dependent variable Y. The fixed effects are then listed after the equal sign. The variable Gender requests a different intercept for the girls and boys, Age models an overall linear growth trend, and Gender*Age makes the slopes different over time. It is actually not necessary to specify Age separately, but doing so enables PROC HPMIXED to carry out a test for heterogeneous slopes.

The REPEATED statement contains a repeated-effect Time. The TYPE=UN option models the covariance as an unstructured block for each SUBJECT=Person. Each of the 27 subjects has a maximum of four observations. Therefore, the matrix is block diagonal with 27 blocks, each block consisting of identical 44 unstructured matrices. The 10 parameters of these unstructured blocks make up the covariance parameters estimated by restricted maximum likelihood. The R= option requests that the first block of be displayed.

The results from this analysis are shown in Output 56.5.1 through Output 56.5.5.

Output 56.5.1: Repeated Measures Analysis

The HPMIXED Procedure

Dimensions
G-side Cov. Parameters0
R-side Cov. Parameters10
Columns in X6
Columns in Z per Subject0
Subjects (Blocks in V)27


In Output 56.5.1, the 10 covariance parameters result from the unstructured blocks of . There is no matrix for this model.

Output 56.5.2: Repeated Measures Analysis (continued)

Number of Observations Read108
Number of Observations Used108

Iteration History
IterationEvaluationsObjective
Function
ChangeMax
Gradient
04483.55903028.18.65974
14446.661815436.8972148814.63195
25430.296710416.3651050010.93182
35427.861490522.4352198812.34361
42426.165281631.696208908.094057
53425.568747430.596534203.517822
62424.919192060.649555372.492626
73424.7317660.187426062.110784
83424.668569660.063196341.417574
92424.638583570.029986091.468348
102424.607873240.030710331.174872
112424.55939490.048478340.601039
123424.553053790.006341110.316659
132424.548869410.004184380.170275
143424.546961940.001907470.072622
153424.54681780.000144130.019582
163424.546800270.000017530.001888
173424.54680020.000000070.000235

Convergence criterion (GCONV=1E-8) satisfied.


The 17 quasi-Newton iterations are used to find the maximum likelihood estimates (Output 56.5.2).

Output 56.5.3: Repeated Measures Analysis (continued)

Estimated R Matrix for Person 1
RowCol1Col2Col3Col4
15.42522.70923.84112.7151
22.70924.19062.97453.3137
33.84112.97456.26324.1332
42.71513.31374.13324.9862


The 44 matrix in Output 56.5.3 is the estimated unstructured covariance matrix. It is the estimate of the first block of , and the other 26 blocks all have the same estimate.

Output 56.5.4: Repeated Measures Analysis (continued)

Covariance Parameter Estimates
Cov ParmSubjectEstimate
UN(1,1)Person5.4252
UN(2,1)Person2.7092
UN(2,2)Person4.1906
UN(3,1)Person3.8411
UN(3,2)Person2.9745
UN(3,3)Person6.2632
UN(4,1)Person2.7151
UN(4,2)Person3.3137
UN(4,3)Person4.1332
UN(4,4)Person4.9862


The "Covariance Parameter Estimates" table in Output 56.5.4 lists the 10 estimated covariance parameters in order; note their correspondence to the first block of displayed in Output 56.5.3. The parameter estimates are labeled according to their location in the block in the Cov Parm column, and all of these estimates are associated with Person as the subject effect.

Output 56.5.5: Repeated Measures Analysis (continued)

Type III Tests of Fixed Effects
EffectNum DFDen DFF ValuePr > F
Gender11041.080.3011
Age1104102.35<.0001
Age*Gender11047.400.0076


The "Type III Tests of Fixed Effects" table in Output 56.5.5 displays Type III tests for all of the fixed effects. These tests are partial in the sense that they account for all of the other fixed effects in the model.

Since the different levels of the repeated effect represent different years, it is natural to try fitting a time series model to the data within each subject. To obtain time series structures in , you can replace TYPE=UN with TYPE=AR(1) to obtain the first-order autoregressive covariance matrices. For example, the statements to fit an AR(1) structure are as follows:

proc hpmixed data=pr;
   class Person Gender Time;
   model y = Gender Age Gender*Age;
   repeated Time / type=ar(1) sub=Person r;
run;

The estimated AR(1) structure covariance matrix of the first block of is shown in Output 56.5.6

Output 56.5.6: Repeated Measures Analysis

The HPMIXED Procedure

Estimated R Matrix for Person 1
RowCol1Col2Col3Col4
15.21443.25632.03351.2699
23.25635.21443.25632.0335
32.03353.25635.21443.2563
41.26992.03353.25635.2144