```Date: Tue, 6 May 1997 16:34:21 GMT Reply-To: Howard Kaplan Sender: "SAS(r) Discussion" From: Howard Kaplan Organization: Psychopharmacology and Dependence Unit, Women's College Hospital, Toronto Subject: Re: GLM and interaction contrasts Content-Type: 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 ```

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