Newsgroups: bit.listserv.spssx-l
Date:         Mon, 17 Aug 1992 09:21:47 CDT
Reply-To:     William Kahn <71020.1025@COMPUSERVE.COM>
Comments:     Resent-From: Anup Kumar Roy <anuproy@vmd.cso.uiuc.edu>
Comments:     Originally-From: William Kahn <71020.1025@COMPUSERVE.COM>
From:         Anup Kumar Roy <anuproy@VMD.CSO.UIUC.EDU>
Subject:      GLM's SS3 ala Dallal

This is definitely worth a repost to the SPSS list, in the hope that some
SPSS Manova "experts" will respond ...

----------------------------Original message----------------------------
/*
Gerald Dallal in _The American Statistician_, August 1992, v46 n3,
p240 brings up partitioning sums of squares again.  (Every year
I think I finally got this one figured out).  He has a simple
2x3 full factorial with 3 reps in cells where A=1 and 6 reps
in cells where A=2. Altogether 27 observations.

When you do GLM, with model A B A*B, the SS3 for B is not the same
as when you use the model A B A*B C(A B).

He asks why explicitly modeling the error term as C(A B) changes
an effect SS.

Also note the behavior of SS4.

SPSS produces still different SS when C(A B) is included.

Here is my code which reproduces his data and the SAS 6.04 SS.
*/

data dallal;
  drop d;
  a=1;
    do d=1 to 3;
      do b=1 to 3;
        c+1;
        input y @;
        output;
      end;
      input;
    end;
  a=2;
    do d=4 to 9;
      do b=1 to 3;
        c+1;
        input y @;
        output;
      end;
      input;
    end;
cards;
3.81 3.42 3.55
4.64 3.57 3.71
4.09 3.55 3.66
0.22 0.36 0.37
0.33 0.27 0.31
0.36 0.26 0.28
1.08 0.83 0.70
1.33 0.90 0.89
1.15 0.93 0.93

proc sort;
  by a b c;

proc print;

proc glm data=dallal;
  class a b c;
  model y=a b a*b/ss1 ss2 ss3 ss4;

proc glm data=dallal;
  class a b c;
  model y=a b a*b c(a b)/ss1 ss2 ss3 ss4;
run;

/*  Here is the output.  The SS I find interesting are pointed to
    with  ==========>

OBS    A    B     C      Y

  1    1    1     1    3.81
  2    1    1     4    4.64
  3    1    1     7    4.09
  4    1    2     2    3.42
  5    1    2     5    3.57
  6    1    2     8    3.55
  7    1    3     3    3.55
  8    1    3     6    3.71
  9    1    3     9    3.66
 10    2    1    10    0.22
 11    2    1    13    0.33
 12    2    1    16    0.36
 13    2    1    19    1.08
 14    2    1    22    1.33
 15    2    1    25    1.15
 16    2    2    11    0.36
 17    2    2    14    0.27
 18    2    2    17    0.26
 19    2    2    20    0.83
 20    2    2    23    0.90
 21    2    2    26    0.93
 22    2    3    12    0.37
 23    2    3    15    0.31
 24    2    3    18    0.28
 25    2    3    21    0.70
 26    2    3    24    0.89
 27    2    3    27    0.93
                                              2:51 Sunday, August 16, 1992  25

General Linear Models Procedure
Class Level Information

Class    Levels    Values

A             2    1 2

B             3    1 2 3

C            27    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
                   23 24 25 26 27


Number of observations in data set = 27


                                              2:51 Sunday, August 16, 1992  26

General Linear Models Procedure

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

Model                    5     59.96957407    11.99391481     97.96     0.0001

Error     =========>    21      2.57130000     0.12244286

Corrected Total         26     62.54087407

                  R-Square            C.V.       Root MSE               Y Mean

                  0.958886        20.76439       0.349918           1.68518519


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

A                        1     59.11574074    59.11574074    482.80     0.0001
B                        2      0.57165185     0.28582593      2.33     0.1215
A*B                      2      0.28218148     0.14109074      1.15     0.3351

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

A                        1     59.11574074    59.11574074    482.80     0.0001
B                        2      0.57165185     0.28582593      2.33     0.1215
A*B                      2      0.28218148     0.14109074      1.15     0.3351

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

A                        1     59.11574074    59.11574074    482.80     0.0001
B        ==========>     2      0.78843333     0.39421667      3.22     0.0603
A*B                      2      0.28218148     0.14109074      1.15     0.3351

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

A                        1     59.11574074    59.11574074    482.80     0.0001
B                        2      0.78843333     0.39421667      3.22     0.0603
A*B                      2      0.28218148     0.14109074      1.15     0.3351



                                              2:51 Sunday, August 16, 1992  27

General Linear Models Procedure
Class Level Information

Class    Levels    Values

A             2    1 2

B             3    1 2 3

C            27    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
                   23 24 25 26 27


Number of observations in data set = 27


                                              2:51 Sunday, August 16, 1992  28

General Linear Models Procedure

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

Model                   26     62.54087407     2.40541823       .        .

Error                    0       .              .

Corrected Total         26     62.54087407

                  R-Square            C.V.       Root MSE               Y Mean

                  1.000000               0              0           1.68518519


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

A                        1     59.11574074    59.11574074       .        .
B                        2      0.57165185     0.28582593       .        .
A*B                      2      0.28218148     0.14109074       .        .
C(A*B)                  21      2.57130000     0.12244286       .        .

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

A                        1     59.11574074    59.11574074       .        .
B                        2      0.57165185     0.28582593       .        .
A*B                      2      0.28218148     0.14109074       .        .
C(A*B)                  21      2.57130000     0.12244286       .        .

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

A                        1     59.11574074    59.11574074       .        .
B        ==========>     2      0.75766365     0.37883182       .        .
A*B                      2      0.28218148     0.14109074       .        .
C(A*B)   ==========>    21      2.57130000     0.12244286       .        .

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

A                        1     59.11574074    59.11574074       .        .
B        ==========>     2      0.57165185     0.28582593       .        .
A*B                      2      0.28218148     0.14109074       .        .
C(A*B)                  21      2.57130000     0.12244286       .        .


Thanks for your reflections on this.  I use nested structures quite
often and want to understand what I am (SAS is) doing.

William Kahn
W. L. Gore and Associates
71020.1025@compuserve.com
(410) 398-6400
*/
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU