One Way MANOVA

This is example 5.9 from a text by Morrison on page 240. There are 4 groups of subjects and each subject was scored on 3 scales called A B and C. The data are in a file called table5.7 in four columns. The first column is group number and the remaining 3 are the A B and C scores respectively.

SAS code to read in the data and print it out:

```    data long;
infile 'table5.7';
input group a b c;
run;
proc print;
run;```
The result is
```     OBS    GROUP     A     B     C

1      1      19    20    18
2      1      20    21    19
3      1      19    22    22
4      1      18    19    21
5      1      16    18    20
6      1      17    22    19
7      1      20    19    20
8      1      15    19    19
9      2      12    14    12
10      2      15    15    17
11      2      15    17    15
12      2      13    14    14
13      2      14    16    13
14      3      15    14    17
15      3      13    14    15
16      3      12    15    15
17      3      12    13    13
18      4       8     9    10
19      4      10    10    12
20      4      11    10    10
21      4      11     7    12```

A one way MANOVA, testing the hypothesis of no group effect is

```proc glm;
class group;
model a b c = group;
manova h=group ;
run;```
which produces the output
```                      General Linear Models Procedure

Dependent Variable: A
Sum of          Mean
Source                  DF        Squares        Square  F Value    Pr > F

Model                    3     190.438095     63.479365    25.21    0.0001

Error                   17      42.800000      2.517647

Corrected Total         20     233.238095

R-Square           C.V.      Root MSE             A Mean

0.816497       10.92489       1.58671            14.5238

Source                  DF      Type I SS   Mean Square  F Value    Pr > F

GROUP                    3     190.438095     63.479365    25.21    0.0001

Source                  DF    Type III SS   Mean Square  F Value    Pr > F

GROUP                    3     190.438095     63.479365    25.21    0.0001

Dependent Variable: B
Sum of          Mean
Source                  DF        Squares        Square  F Value    Pr > F

Model                    3     340.152381    113.384127    62.58    0.0001

Error                   17      30.800000      1.811765

Corrected Total         20     370.952381

R-Square           C.V.      Root MSE             B Mean

0.916970       8.617799       1.34602            15.6190

Source                  DF      Type I SS   Mean Square  F Value    Pr > F

GROUP                    3     340.152381    113.384127    62.58    0.0001

Source                  DF    Type III SS   Mean Square  F Value    Pr > F

GROUP                    3     340.152381    113.384127    62.58    0.0001

Dependent Variable: C
Sum of          Mean
Source                  DF        Squares        Square  F Value    Pr > F

Model                    3     232.271429     77.423810    34.37    0.0001

Error                   17      38.300000      2.252941

Corrected Total         20     270.571429

R-Square           C.V.      Root MSE             C Mean

0.858448       9.465640       1.50098            15.8571

Source                  DF      Type I SS   Mean Square  F Value    Pr > F

GROUP                    3     232.271429     77.423810    34.37    0.0001

Source                  DF    Type III SS   Mean Square  F Value    Pr > F

GROUP                    3     232.271429     77.423810    34.37    0.0001

General Linear Models Procedure
Multivariate Analysis of Variance

Characteristic Roots and Vectors of: E Inverse * H, where
H = Type III SS&CP Matrix for GROUP   E = Error SS&CP Matrix

Characteristic   Percent        Characteristic Vector  V'EV=1
Root
A              B
C

15.3752900     98.30            0.01127992     0.13817484
0.08125989

0.2307260      1.48           -0.04455525    -0.09323432
0.15450684

0.0356937      0.23           -0.17287851     0.09020041
0.04776837

Manova Test Criteria and F Approximations for
the Hypothesis of no Overall GROUP Effect
H = Type III SS&CP Matrix for GROUP   E = Error SS&CP Matrix

S=3    M=-0.5    N=6.5

Statistic                    Value          F      Num DF    Den DF  Pr > F

Wilks' Lambda             0.04790913    10.1213         9  36.65666  0.0001
Pillai's Trace            1.16086747     3.5768         9        51  0.0016
Hotelling-Lawley Trace   15.64170973    23.7522         9        41  0.0001
Roy's Greatest Root      15.37528995    87.1266         3        17  0.0001

NOTE: F Statistic for Roy's Greatest Root is an upper bound.```
The output shows univariate analysis for each of the 3 response variables and then the one way MANOVA analysis. The data set is actually an unbalanced design. Here is what happens if we analyze only the data for the first two groups.
```    data long;
infile 'tab57sh';
input group a b c;
run;
proc print;
run;
proc glm;
class group;
model a b c = group;
manova h=group / printh printe;
run;```
The result is
```                              The SAS System                             52
08:02 Wednesday, January 28, 1998

OBS    GROUP     A     B     C

1      1      19    20    18
2      1      20    21    19
3      1      19    22    22
4      1      18    19    21
5      1      16    18    20
6      1      17    22    19
7      1      20    19    20
8      1      15    19    19
9      2      12    14    12
10      2      15    15    17
11      2      15    17    15
12      2      13    14    14
13      2      14    16    13

General Linear Models Procedure

Dependent Variable: A
Sum of          Mean
Source                  DF        Squares        Square  F Value    Pr > F

Model                    1     54.2769231    54.2769231    19.38    0.0011

Error                   11     30.8000000     2.8000000

Corrected Total         12     85.0769231

R-Square           C.V.      Root MSE             A Mean

0.637975       10.21275       1.67332            16.3846

Dependent Variable: B
Sum of          Mean
Source                  DF        Squares        Square  F Value    Pr > F

Model                    1     70.8923077    70.8923077    34.20    0.0001

Error                   11     22.8000000     2.0727273

Corrected Total         12     93.6923077

R-Square           C.V.      Root MSE             B Mean

0.756650       7.930534       1.43970            18.1538

Dependent Variable: C
Sum of          Mean
Source                  DF        Squares        Square  F Value    Pr > F

Model                    1     94.7769231    94.7769231    39.64    0.0001

Error                   11     26.3000000     2.3909091

Corrected Total         12    121.0769231

R-Square           C.V.      Root MSE             C Mean

0.782783       8.777875       1.54626            17.6154

E = Error SS&CP Matrix

A                 B                 C

A              30.8              12.2              10.2
B              12.2              22.8               3.8
C              10.2               3.8              26.3

General Linear Models Procedure
Multivariate Analysis of Variance

Partial Correlation Coefficients from the Error SS&CP Matrix / Prob > |r|

DF = 11            A         B         C

A           1.000000  0.460381  0.358383
0.0001    0.1320    0.2527

B           0.460381  1.000000  0.155181
0.1320    0.0001    0.6301

C           0.358383  0.155181  1.000000
0.2527    0.6301    0.0001

H = Type III SS&CP Matrix for GROUP

A                 B                 C

A      54.276923077      62.030769231      71.723076923
B      62.030769231      70.892307692      81.969230769
C      71.723076923      81.969230769      94.776923077

Characteristic Roots and Vectors of: E Inverse * H, where
H = Type III SS&CP Matrix for GROUP   E = Error SS&CP Matrix

Characteristic   Percent        Characteristic Vector  V'EV=1
Root
A              B
C

5.81615862    100.00            0.00403434     0.12874606
0.13332232
The SAS System                             62
08:02 Wednesday, January 28, 1998

General Linear Models Procedure
Multivariate Analysis of Variance

Characteristic Roots and Vectors of: E Inverse * H, where
H = Type III SS&CP Matrix for GROUP   E = Error SS&CP Matrix

Characteristic   Percent        Characteristic Vector  V'EV=1
Root
A              B
C

0.00000000      0.00           -0.09464169    -0.10311602
0.16080216

0.00000000      0.00           -0.19278508     0.16868694
0.00000000

General Linear Models Procedure
Multivariate Analysis of Variance

Manova Test Criteria and Exact F Statistics for
the Hypothesis of no Overall GROUP Effect
H = Type III SS&CP Matrix for GROUP   E = Error SS&CP Matrix

S=1    M=0.5    N=3.5

Statistic                    Value          F      Num DF    Den DF  Pr > F

Wilks' Lambda             0.14671020    17.4485         3         9  0.0004
Pillai's Trace            0.85328980    17.4485         3         9  0.0004
Hotelling-Lawley Trace    5.81615862    17.4485         3         9  0.0004
Roy's Greatest Root       5.81615862    17.4485         3         9  0.0004
General Linear Models Procedure
Multivariate Analysis of Variance

Characteristic Roots and Vectors of: E Inverse * H, where
H = Type III SS&CP Matrix for GROUP   E = Error SS&CP Matrix

Characteristic   Percent        Characteristic Vector  V'EV=1
Root
A              B
C

5.81615862    100.00            0.00403434     0.12874606
0.13332232

0.00000000      0.00           -0.09464169    -0.10311602
0.16080216

0.00000000      0.00           -0.19278508     0.16868694
0.00000000

Manova Test Criteria and Exact F Statistics for
the Hypothesis of no Overall GROUP Effect
H = Type III SS&CP Matrix for GROUP   E = Error SS&CP Matrix

S=1    M=0.5    N=3.5

Statistic                    Value          F      Num DF    Den DF  Pr > F

Wilks' Lambda             0.14671020    17.4485         3         9  0.0004
Pillai's Trace            0.85328980    17.4485         3         9  0.0004
Hotelling-Lawley Trace    5.81615862    17.4485         3         9  0.0004
Roy's Greatest Root       5.81615862    17.4485         3         9  0.0004```
The quantities labelled "Characteristic Root" are eigenvalues; only one is non-zero in this problem. The various test statistics all lead to the same F value and the conclusion that groups 1 and 2 have different multivariate means.

Now we examine univariate approaches to the data. Here we tell SAS that the variables A, B and C are repeated measurements of the same quantity.

```proc glm;
class group;
model a b c = group;
repeated scale;
run;```
These statements actually do two analyses. The class group statement says that the numbers 1 to 4 in the column called group are levels of a categorical factor.

The model statement says that there are 3 response variables and 1 independent variable. It does multivariate analysis of variance tests for the hypotheses of no scale by group interaction (the hypothesis of parallelism) and for the hypothesis of no scale effect. It does a univariate test of no group effect by adding together the 3 scales to get a single total score for each individual.

The results are as follows:

```                  Linear Models Procedure
Class Level Information
Class    Levels    Values

GROUP         4    1 2 3 4

Number of observations in data set = 21

Dependent Variable: A
Sum of           Mean
Source                  DF         Squares         Square  F Value Pr > F
Model                    3     190.4380952     63.4793651    25.21    0.0001
Error                   17      42.8000000     2.5176471
Corrected Total         20     233.2380952

R-Square              C.V.       Root MSE             A Mean
0.816497           10.92489       1.586710           14.52381

Source   DF       Type I SS    Mean Square  F Value    Pr > F
GROUP     3     190.4380952     63.4793651    25.21    0.0001
Source   DF     Type III SS    Mean Square  F Value    Pr > F
GROUP     3     190.4380952     63.4793651    25.21    0.0001

Dependent Variable: B
Sum of           Mean
Source                  DF         Squares         Square  F Value    Pr > F
Model                    3     340.1523810    113.3841270    62.58    0.0001
Error                   17      30.8000000      1.8117647
Corrected Total         20     370.9523810

R-Square            C.V.       Root MSE             B Mean
0.916970        8.617799      1.346018           15.61905

Source                  DF       Type I SS    Mean Square  F Value    Pr > F
GROUP                    3     340.1523810    113.3841270    62.58    0.0001
Source                  DF     Type III SS    Mean Square  F Value    Pr > F
GROUP                    3     340.1523810    113.3841270    62.58    0.0001

Dependent Variable: C

Sum of           Mean
Source           DF       Squares         Square     F Value    Pr > F
Model             3     232.2714286     77.4238095    34.37    0.0001
Error            17      38.3000000      2.2529412
Corrected Total  20     270.5714286

R-Square            C.V.       Root MSE             C Mean

0.858448        9.465640       1.500980           15.85714

Source                  DF       Type I SS    Mean Square  F Value    Pr > F
GROUP                    3     232.2714286     77.4238095    34.37    0.0001
Source                  DF     Type III SS    Mean Square  F Value    Pr > F
GROUP                    3     232.2714286     77.4238095    34.37    0.0001

General Linear Models Procedure
Repeated Measures Analysis of Variance
Repeated Measures Level Information

Dependent Variable          A        B        C

Level of SCALE      1        2        3

Manova Test Criteria and Exact F Statistics for the Hypothesis of no
SCALE Effect
H = Type III SS&CP Matrix for SCALE   E = Error SS&CP Matrix

S=1    M=0    N=7
Statistic
Value          F      Num DF    Den DF  Pr > F
Wilks' Lambda             0.56372926     6.1912         2        16  0.0102
Pillai's Trace            0.43627074     6.1912         2        16  0.0102
Hotelling-Lawley Trace    0.77390120     6.1912         2        16  0.0102
Roy's Greatest Root       0.77390120     6.1912         2        16  0.0102

Manova Test Criteria and F Approximations for the Hypothesis of no
SCALE*GROUP Effect
H = Type III SS&CP Matrix for SCALE*GROUP   E = Error SS&CP Matrix
S=2    M=0    N=7

Statistic             Value          F         Num DF    Den DF  Pr > F
Wilks' Lambda          0.56333190     1.7725         6        32  0.1364
Pillai's Trace            0.48726039     1.8253         6        34  0.1234
Hotelling-Lawley Trace    0.68534343     1.7134         6        30  0.1522
Roy's Greatest Root       0.50884896     2.8835         3        17  0.0662

NOTE: F Statistic for Roy's Greatest Root is an upper bound.
NOTE: F Statistic for Wilks' Lambda is exact.```
The repeated statement causes sas to do a univariate anova based analysis for the model. The results are
```                       General Linear Models Procedure
Repeated Measures Analysis of Variance
Tests of Hypotheses for Between Subjects Effects

Source                  DF     Type III SS    Mean Square  F Value    Pr > F
GROUP                    3      743.900000     247.966667    70.93    0.0001
Error                   17       59.433333       3.496078

General Linear Models Procedure
Repeated Measures Analysis of Variance
Univariate Tests of Hypotheses for Within Subject Effects

Source: SCALE                                             Adj Pr > F
DF     Type III SS     Mean Square   F Value   Pr > F    G - G    H - F
2     16.62424242      8.31212121      5.39   0.0093 0.0101   0.0093 ˙
Source: SCALE*GROUP
DF     Type III SS     Mean Square   F Value Pr > F    G - G    H - F
6     18.96190476      3.16031746      2.05   0.0860   0.0889   0.0860
Source: Error(SCALE)
DF     Type III SS     Mean Square
34     52.46666667     1.54313725

Greenhouse-Geisser Epsilon = 0.9664
Huynh-Feldt Epsilon = 1.2806```
The following two files do univariate anova: The data reordered:
```1 1 1 19
1 1 2 20
1 1 3 18
2 1 1 20
2 1 2 21
2 1 3 19
3 1 1 19
3 1 2 22
3 1 3 22
4 1 1 18
4 1 2 19
4 1 3 21
5 1 1 16
5 1 2 18
5 1 3 20
6 1 1 17
6 1 2 22
6 1 3 19
7 1 1 20
7 1 2 19
7 1 3 20
8 1 1 15
8 1 2 19
8 1 3 19
1 2 1 12
1 2 2 14
1 2 3 12
2 2 1 15
2 2 2 15
2 2 3 17
3 2 1 15
3 2 2 17
3 2 3 15
4 2 1 13
4 2 2 14
4 2 3 14
5 2 1 14
5 2 2 16
5 2 3 13
1 3 1 15
1 3 2 14
1 3 3 17
2 3 1 13
2 3 2 14
2 3 3 15
3 3 1 12
3 3 2 15
3 3 3 15
4 3 1 12
4 3 2 13
4 3 3 13
1 4 1 8
1 4 2 9
1 4 3 10
2 4 1 10
2 4 2 10
2 4 3 12
3 4 1 11
3 4 2 10
3 4 3 10
4 4 1 11
4 4 2 7
4 4 3 12```
The sas commands:
```    data long;
infile 'table5.7uni';
input subject group scale score;
run;
proc print;
run;
proc glm;
class group;
class scale;
class subject;
model score =group subject(group) scale group*scale;
random subject(group) ;
run;```
Some of the output:
```                      General Linear Models Procedure

Dependent Variable: SCORE
Sum of           Mean
Source                  DF         Squares         Square  F Value    Pr > F
Model                   28     843.5333333     30.1261905    19.52    0.0001
Error                   34      52.4666667      1.5431373
Corrected Total         62     896.0000000

R-Square            C.V.       Root MSE         SCORE Mean

0.941443        8.101505       1.242231           15.33333

Source                  DF       Type I SS    Mean Square  F Value    Pr > F

GROUP                    3     743.9000000    247.9666667   160.69  0.0001
SUBJECT(GROUP)          17      59.4333333      3.4960784   2.27    0.0208
SCALE                    2      21.2380952     10.6190476   6.88    0.0031
GROUP*SCALE              6      18.9619048      3.1603175   2.05    0.0860
Source                  DF     Type III SS    Mean Square  F Value    Pr > F
GROUP                    3   743.9000000    247.9666667   160.69    0.0001
SUBJECT(GROUP)          17    59.4333333      3.4960784     2.27    0.0208
SCALE                    2    16.6242424      8.3121212     5.39    0.0093
GROUP*SCALE              6    18.9619048      3.1603175     2.05    0.0860

General Linear Models Procedure

Source           Type III Expected Mean Square

GROUP            Var(Error) + 3 Var(SUBJECT(GROUP)) + Q(GROUP,GROUP*SCALE)
SUBJECT(GROUP)   Var(Error) + 3 Var(SUBJECT(GROUP))
SCALE            Var(Error) + Q(SCALE,GROUP*SCALE)
GROUP*SCALE      Var(Error) + Q(GROUP*SCALE)```

The difference between the types of error sums of squares arises because the design is unbalanced. Notice that the hypothesis of no group by scale interaction is acceptable. Under the assumption of no such group by scale interaction the hypothesis of no group effect is tested by dividing group ms by subject(group) ms for which the value is 70.9 on 3,17 degrees of freedom. This is NOT the F value in the table above since the table above is for FIXED effects. Notice that the sums of squares in this table match those produced in the repeated measures ANOVA. This is not accidental.

Richard Lockhart
Tue Feb 17 22:48:57 PST 1998