Date: Tue, 6 May 1997 16:39:56 +0200 Hans-Peter Piepho "SAS(r) Discussion" Hans-Peter Piepho Re: GLM and interaction contrasts To: Howard Kaplan text/plain; charset="us-ascii"

>This question was apparently posted recently (I missed the original >post): >> >>Does anyone know of a good place to find out about constructing = >>interaction contrasts in PROC GLM? I can construct contrasts across = >>single factors fine, but not with interactions. I know it's possible, I >>I just don't understand how they're constructed. >> >>For instance, in a 3*3 design, one possible contrast across either = >>factor would be -1 1 0. However -1 0 0 0 0 0 0 0 1 is not a valid = >>interaction contrast, though that's how many means there are. >> model y=a*b; >> contrast '-11 + 33' -1 0 0 0 0 0 0 0 1; >> > >Hans-Peter Piepho wrote a response: >> The model is overparamaterized. Therefore, contrasts among interactions >> are not estimable. If you want contrasts among the 9 individual means >> of the 3 x 3 design, use the cell means model. > >The problem is not over-parameterization; the problem is that the >contrast statement is incomplete. Look at it this way: The expected >value of the a=1, b=1 cell is the sum of the overall mean, two main >effect adjustments, and one interaction adjustment: > a +1 0 0 b +1 0 0 a*b +1 0 0 0 0 0 0 0 0 >and the expected value of the a=3, b=3 cell is similarly this: > a 0 0 +1 b 0 0 +1 a*b 0 0 0 0 0 0 0 0 +1 >Therefore, the contrast must be the difference between these two >formulas: > a +1 0 -1 b +1 0 -1 a*b +1 0 0 0 0 0 0 0 -1 > >If you write it this way, then SAS is happy and gives you the contrast. >Here's a little test program to demonstrate that: > >data foo; > do rep=1 to 4; > do a=1 to 3; > do b=1 to 3; > y=a+b+(rannor(1)*0.4); > combined=10*a+b; /* combine a and b into one variable */ > output; > end; > end; > end; >run; > >proc glm data=foo; > class a b; > model y=a b a*b; > contrast "-11 +33" a +1 0 -1 > b +1 0 -1 > a*b +1 0 0 0 0 0 0 0 -1; >run; > >proc glm data=foo; > class combined; > model y=combined; > contrast "-11 +33" combined +1 0 0 0 0 0 0 0 -1; >run; >quit; > >If you run this program, you find that both contrasts give you the >same results, which they should. > >-- >Howard L. Kaplan >Psychopharmacology and Dependence Research Unit >Women's College Hospital >76 Grenville Street, 9'th floor >Toronto, Ontario >Canada M5S 1B2 >(416)323-6400, ext 4915 >howard.kaplan@utoronto.ca > >

All fine. Nevertheless, the problem with the original post IS opverparametrization. Interactions are not estimable without restrictions. In your solution, you are setting up contrasts among cell means using the overparameterized model. These involve main effects. These contrasts are estimable. The interactions themselves are not. For details see Searle SR 1987 Linear models for unbalanced data or Searle SR 1971 Linear models

I find it simpler to use the cell means model directly.

Hans-Peter _______________________________________________________________________ Hans-Peter Piepho Institut f. Nutzpflanzenkunde WWW: http://www.wiz.uni-kassel.de/fts/ Universitaet Kassel Mail: piepho@wiz.uni-kassel.de Steinstrasse 19 Fax: +49 5542 98 1230 37213 Witzenhausen, Germany Phone: +49 5542 98 1248

Back to: Top of message | Previous page | Main SAS-L page