# The HPMIXED Procedure

### Example 55.5 Repeated Measures

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 55.5.1 through Output 55.5.5.

Output 55.5.1: Repeated Measures Analysis

The HPMIXED Procedure

Dimensions
G-side Cov. Parameters 0
R-side Cov. Parameters 10
Columns in X 6
Columns in Z per Subject 0
Subjects (Blocks in V) 27

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

Output 55.5.2: Repeated Measures Analysis (continued)

 Number of Observations Read 108 108

Iteration History
Iteration Evaluations Objective
Function
Change Max
0 4 483.55903028 . 18.65974
1 4 446.6618154 36.89721488 14.63195
2 5 430.2967104 16.36510500 10.93182
3 5 427.86149052 2.43521988 12.34361
4 2 426.16528163 1.69620890 8.094057
5 3 425.56874743 0.59653420 3.517822
6 2 424.91919206 0.64955537 2.492626
7 3 424.731766 0.18742606 2.110784
8 3 424.66856966 0.06319634 1.417574
9 2 424.63858357 0.02998609 1.468348
10 2 424.60787324 0.03071033 1.174872
11 2 424.5593949 0.04847834 0.601039
12 3 424.55305379 0.00634111 0.316659
13 2 424.54886941 0.00418438 0.170275
14 3 424.54696194 0.00190747 0.072622
15 3 424.5468178 0.00014413 0.019582
16 3 424.54680027 0.00001753 0.001888
17 3 424.5468002 0.00000007 0.000235

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

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

Output 55.5.3: Repeated Measures Analysis (continued)

Estimated R Matrix for Person 1
Row Col1 Col2 Col3 Col4
1 5.4252 2.7092 3.8411 2.7151
2 2.7092 4.1906 2.9745 3.3137
3 3.8411 2.9745 6.2632 4.1332
4 2.7151 3.3137 4.1332 4.9862

The 44 matrix in Output 55.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 55.5.4: Repeated Measures Analysis (continued)

Covariance Parameter Estimates
Cov Parm Subject Estimate
UN(1,1) Person 5.4252
UN(2,1) Person 2.7092
UN(2,2) Person 4.1906
UN(3,1) Person 3.8411
UN(3,2) Person 2.9745
UN(3,3) Person 6.2632
UN(4,1) Person 2.7151
UN(4,2) Person 3.3137
UN(4,3) Person 4.1332
UN(4,4) Person 4.9862

The "Covariance Parameter Estimates" table in Output 55.5.4 lists the 10 estimated covariance parameters in order; note their correspondence to the first block of displayed in Output 55.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 55.5.5: Repeated Measures Analysis (continued)

Type III Tests of Fixed Effects
Effect Num DF Den DF F Value Pr > F
Gender 1 104 1.08 0.3011
Age 1 104 102.35 <.0001
Age*Gender 1 104 7.40 0.0076

The "Type III Tests of Fixed Effects" table in Output 55.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 55.5.6

Output 55.5.6: Repeated Measures Analysis

The HPMIXED Procedure

Estimated R Matrix for Person 1
Row Col1 Col2 Col3 Col4
1 5.2144 3.2563 2.0335 1.2699
2 3.2563 5.2144 3.2563 2.0335
3 2.0335 3.2563 5.2144 3.2563
4 1.2699 2.0335 3.2563 5.2144