The GLM Procedure

Simple Effects

(View the complete code for this example.)

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 47.21. The Type I and Type III results are the same because this is a balanced design.

Figure 47.21: Two-Way Design with Significant Interaction

The GLM Procedure
 
Dependent Variable: Y

SourceDFType I SSMean SquareF ValuePr > F
A2219.905000109.952500165.11<.0001
B23206.1016671603.0508332407.25<.0001
A*B4487.103333121.775833182.87<.0001

SourceDFType III SSMean SquareF ValuePr > F
A2219.905000109.952500165.11<.0001
B23206.1016671603.0508332407.25<.0001
A*B4487.103333121.775833182.87<.0001


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 47.22. Note that A has a significant effect for B=1 but not for B=2 and B=3.

Figure 47.22: Interaction LS-Means and Simple Effects

The GLM Procedure
Least Squares Means

ABY LSMEAN
1110.8750000
120.2750000
130.2750000
2119.4750000
220.1750000
23-0.7250000
3129.6250000
320.3750000
33-0.5000000

The GLM Procedure
Least Squares Means

A*B Effect Sliced by B for Y
BDFSum of SquaresMean SquareF ValuePr > F
12704.726667352.363333529.13<.0001
220.0800000.0400000.060.9418
322.2016671.1008331.650.2103