Unbalanced ANOVA Computer Exercise
I have included SAS code below to make the point that the hypothesis test of main effects in a two-way ANOVA with interaction depends upon the constraints imposed upon model effects. In the first example, SAS uses (by default) the usual sum-to-zero constraints:
In the next example, we used the constraints:
Execute the SAS code. Note that the model sum of squares is the same for both the PROC GLM and PROC REG output (This is to reassure you that these two dissimilar sets of statements are actually fitting the same model). Look at the tests of the main effects and the interaction for both models. What generalization might you make about the test of main effects in models with interaction? What generalization might you make about the test of interaction?
data a; input teacher method $ diff meth1 meth2 teach1; t1m1=teach1*meth1; t1m2=teach1*meth2; cards; 1 a 10 1 0 1 1 a 7 1 0 1 1 b 4 0 1 1 1 c 16 0 0 1 1 c 19 0 0 1 5 a 6 1 0 0 5 a 9 1 0 0 5 a 8 1 0 0 5 b 3 0 1 0 5 c 10 0 0 0 proc glm; classes teacher method; model diff=teacher|method; proc reg; model diff=teach1 meth1 meth2 t1m1 t1m2; method: test meth1=0,meth2=0; teacher: test teach1=0; mbyt: test t1m1=0,t1m2=0; run;