### Example 42.9 Analyzing a Doubly Multivariate Repeated Measures Design

This example shows how to analyze a doubly multivariate repeated measures design by using PROC GLM with an IDENTITY factor in the REPEATED statement. Note that this differs from previous releases of PROC GLM, in which you had to use a MANOVA statement to get a doubly repeated measures analysis.

Two responses, Y1 and Y2, are each measured three times for each subject (pretreatment, posttreatment, and in a later follow-up). Each subject receives one of three treatments; A, B, or the control. In PROC GLM, you use a REPEATED factor of type IDENTITY to identify the different responses and another repeated factor to identify the different measurement times. The repeated measures analysis includes multivariate tests for time and treatment main effects, as well as their interactions, across responses. The following statements produce Output 42.9.1 through Output 42.9.3.

```options ls=96;
data Trial;
input Treatment \$ Repetition PreY1 PostY1 FollowY1
PreY2 PostY2 FollowY2;
datalines;
A        1  3  13  9  0  0  9
A        2  0  14 10  6  6  3
A        3  4   6 17  8  2  6
A        4  7   7 13  7  6  4
A        5  3  12 11  6 12  6
A        6 10  14  8 13  3  8
B        1  9  11 17  8 11 27
B        2  4  16 13  9  3 26
B        3  8  10  9 12  0 18
B        4  5   9 13  3  0 14
B        5  0  15 11  3  0 25
B        6  4  11 14  4  2  9
Control  1 10  12 15  4  3  7
Control  2  2   8 12  8  7 20
Control  3  4   9 10  2  0 10
Control  4 10   8  8  5  8 14
Control  5 11  11 11  1  0 11
Control  6  1  5  15  8  9 10
;
```
```proc glm data=Trial;
class Treatment;
model PreY1 PostY1 FollowY1
PreY2 PostY2 FollowY2 = Treatment / nouni;
repeated Response 2 identity, Time 3;
run;
```

Output 42.9.1: A Doubly Multivariate Repeated Measures Design

The GLM Procedure

Class Level Information
Class Levels Values
Treatment 3 A B Control

 Number of Observations Read 18 18

The levels of the repeated factors are displayed in Output 42.9.2. Note that RESPONSE is 1 for all the Y1 measurements and 2 for all the Y2 measurements, while the three levels of `Time` identify the pretreatment, posttreatment, and follow-up measurements within each response. The multivariate tests for within-subject effects are displayed in Output 42.9.3.

Output 42.9.2: Repeated Factor Levels

The GLM Procedure
Repeated Measures Analysis of Variance

Repeated Measures Level Information
Dependent Variable PreY1 PostY1 FollowY1 PreY2 PostY2 FollowY2
Level of Response 1 1 1 2 2 2
Level of Time 1 2 3 1 2 3

Output 42.9.3: Within-Subject Tests

MANOVA Test Criteria and Exact F Statistics for the Hypothesis of no Response Effect
H = Type III SSCP Matrix for Response
E = Error SSCP Matrix

S=1 M=0 N=6
Statistic Value F Value Num DF Den DF Pr > F
Wilks' Lambda 0.02165587 316.24 2 14 <.0001
Pillai's Trace 0.97834413 316.24 2 14 <.0001
Hotelling-Lawley Trace 45.17686368 316.24 2 14 <.0001
Roy's Greatest Root 45.17686368 316.24 2 14 <.0001

MANOVA Test Criteria and F Approximations for the Hypothesis of no Response*Treatment Effect
H = Type III SSCP Matrix for Response*Treatment
E = Error SSCP Matrix

S=2 M=-0.5 N=6
Statistic Value F Value Num DF Den DF Pr > F
Wilks' Lambda 0.72215797 1.24 4 28 0.3178
Pillai's Trace 0.27937444 1.22 4 30 0.3240
Hotelling-Lawley Trace 0.38261660 1.31 4 15.818 0.3074
Roy's Greatest Root 0.37698780 2.83 2 15 0.0908

MANOVA Test Criteria and Exact F Statistics for the Hypothesis of no Response*Time Effect
H = Type III SSCP Matrix for Response*Time
E = Error SSCP Matrix

S=1 M=1 N=5
Statistic Value F Value Num DF Den DF Pr > F
Wilks' Lambda 0.14071380 18.32 4 12 <.0001
Pillai's Trace 0.85928620 18.32 4 12 <.0001
Hotelling-Lawley Trace 6.10662362 18.32 4 12 <.0001
Roy's Greatest Root 6.10662362 18.32 4 12 <.0001

MANOVA Test Criteria and F Approximations for the Hypothesis of no Response*Time*Treatment Effect
H = Type III SSCP Matrix for Response*Time*Treatment
E = Error SSCP Matrix

S=2 M=0.5 N=5
Statistic Value F Value Num DF Den DF Pr > F
Wilks' Lambda 0.22861451 3.27 8 24 0.0115
Pillai's Trace 0.96538785 3.03 8 26 0.0151
Hotelling-Lawley Trace 2.52557514 3.64 8 15 0.0149
Roy's Greatest Root 2.12651905 6.91 4 13 0.0033

The table for `Response`*`Treatment` tests for an overall treatment effect across the two responses; likewise, the tables for `Response`*`Time` and `Response`*`Treatment`*`Time` test for time and the treatment-by-time interaction, respectively. In this case, there is a strong main effect for time and possibly for the interaction, but not for treatment.

In previous releases (before the IDENTITY transformation was introduced), in order to perform a doubly repeated measures analysis, you had to use a MANOVA statement with a customized transformation matrix M. You might still want to use this approach to see details of the analysis, such as the univariate ANOVA for each transformed variate. The following statements demonstrate this approach by using the MANOVA statement to test for the overall main effect of time and specifying the SUMMARY option.

```proc glm data=Trial;
class Treatment;
model PreY1 PostY1 FollowY1
PreY2 PostY2 FollowY2 = Treatment / nouni;
manova  h=intercept  m=prey1 - posty1,
prey1 - followy1,
prey2 - posty2,
prey2 - followy2 / summary;
run;
```

The M matrix used to perform the test for time effects is displayed in Output 42.9.4, while the results of the multivariate test are given in Output 42.9.5. Note that the test results are the same as for the `Response`*`Time` effect in Output 42.9.3.

Output 42.9.4: M Matrix to Test for Time Effect (Repeated Measure)

The GLM Procedure
Multivariate Analysis of Variance

M Matrix Describing Transformed Variables
PreY1 PostY1 FollowY1 PreY2 PostY2 FollowY2
MVAR1 1 -1 0 0 0 0
MVAR2 1 0 -1 0 0 0
MVAR3 0 0 0 1 -1 0
MVAR4 0 0 0 1 0 -1

Output 42.9.5: Tests for Time Effect (Repeated Measure)

The GLM Procedure
Multivariate Analysis of Variance

Characteristic Roots and Vectors of: E Inverse * H, where
H = Type III SSCP Matrix for Intercept
E = Error SSCP Matrix

Variables have been transformed by the M Matrix
Characteristic Root Percent Characteristic Vector V'EV=1
MVAR1 MVAR2 MVAR3 MVAR4
6.10662362 100.00 -0.00157729 0.04081620 -0.04210209 0.03519437
0.00000000 0.00 0.00796367 0.00493217 0.05185236 0.00377940
0.00000000 0.00 -0.03534089 -0.01502146 -0.00283074 0.04259372
0.00000000 0.00 -0.05672137 0.04500208 0.00000000 0.00000000

MANOVA Test Criteria and Exact F Statistics for the Hypothesis of No Overall Intercept Effect
on the Variables Defined by the M Matrix Transformation
H = Type III SSCP Matrix for Intercept
E = Error SSCP Matrix

S=1 M=1 N=5
Statistic Value F Value Num DF Den DF Pr > F
Wilks' Lambda 0.14071380 18.32 4 12 <.0001
Pillai's Trace 0.85928620 18.32 4 12 <.0001
Hotelling-Lawley Trace 6.10662362 18.32 4 12 <.0001
Roy's Greatest Root 6.10662362 18.32 4 12 <.0001

The SUMMARY option in the MANOVA statement creates an ANOVA table for each transformed variable as defined by the M matrix. MVAR1 and MVAR2 contrast the pretreatment measurement for Y1 with the posttreatment and follow-up measurements for Y1, respectively; MVAR3 and MVAR4 are the same contrasts for Y2. Output 42.9.6 displays these univariate ANOVA tables and shows that the contrasts are all strongly significant except for the pre-versus-post difference for Y2.

Output 42.9.6: Summary Output for the Test for Time Effect

The GLM Procedure
Multivariate Analysis of Variance

Dependent Variable: MVAR1

Source DF Type III SS Mean Square F Value Pr > F
Intercept 1 512.0000000 512.0000000 22.65 0.0003
Error 15 339.0000000 22.6000000

The GLM Procedure
Multivariate Analysis of Variance

Dependent Variable: MVAR2

Source DF Type III SS Mean Square F Value Pr > F
Intercept 1 813.3888889 813.3888889 32.87 <.0001
Error 15 371.1666667 24.7444444

The GLM Procedure
Multivariate Analysis of Variance

Dependent Variable: MVAR3

Source DF Type III SS Mean Square F Value Pr > F
Intercept 1 68.0555556 68.0555556 3.49 0.0814
Error 15 292.5000000 19.5000000

The GLM Procedure
Multivariate Analysis of Variance

Dependent Variable: MVAR4

Source DF Type III SS Mean Square F Value Pr > F
Intercept 1 800.0000000 800.0000000 26.43 0.0001
Error 15 454.0000000 30.2666667