Suppose you use the following statements to fit a full factorial model to a two-way design:
data twoway; input A B Y @@; datalines; 1 1 10.6 1 1 11.0 1 1 10.6 1 1 11.3 1 2 -0.2 1 2 1.3 1 2 -0.2 1 2 0.2 1 3 0.1 1 3 0.4 1 3 -0.4 1 3 1.0 2 1 19.7 2 1 19.3 2 1 18.5 2 1 20.4 2 2 -0.2 2 2 0.5 2 2 0.8 2 2 -0.4 2 3 -0.9 2 3 -0.1 2 3 -0.2 2 3 -1.7 3 1 29.7 3 1 29.6 3 1 29.0 3 1 30.2 3 2 1.5 3 2 0.2 3 2 -1.5 3 2 1.3 3 3 0.2 3 3 0.4 3 3 -0.4 3 3 -2.2 ;
proc glm data=twoway; class A B; model Y = A B A*B; run;
Partial results for the analysis of variance are shown in Figure 46.21. The Type I and Type III results are the same because this is a balanced design.
Figure 46.21: Two-Way Design with Significant Interaction
The interaction A
*B
is significant, indicating that the effect of A
depends on the level of B. In some cases, you might be interested in looking at the differences between predicted values
across A
for different levels of B
. Winer (1971) calls this the simple effects of A
. You can compute simple effects with the LSMEANS
statement by specifying the SLICE=
option. In this case, since the GLM procedure is interactive, you can compute the simple effects of A
by submitting the following statements after the preceding statements.
lsmeans A*B / slice=B; run;
The results are shown Figure 46.22. Note that A
has a significant effect for B
=1 but not for B
=2 and B
=3.
Figure 46.22: Interaction LS-Means and Simple Effects