Suppose you want to compute power for the two-way ANOVA described in the section Simple Two-Way ANOVA, but you want to additionally perform the following tasks:
try an unbalanced sample size allocation with respect to Exposure
, using twice as many samples for levels 2 and 3 as for level 1
consider an additional, less optimistic scenario for the cell means, shown in Table 44.2
test a contrast of Exposure
comparing levels 1 and 3
To specify the unbalanced design and the additional cell means scenario, you can add two new variables to the exemplary data
set (Weight
for the sample size weights, and HeightNew
for the new cell means scenario). Change the name of the original cell means scenario to HeightOrig
. The following statements define the exemplary data set:
data Exemplary; input Variety $ Exposure $ HeightOrig HeightNew Weight; datalines; 1 1 14 15 1 1 2 16 16 2 1 3 21 20 2 2 1 10 11 1 2 2 15 14 2 2 3 16 15 2 ;
In PROC GLMPOWER, specify the name of the weight variable by using the WEIGHT statement, and specify the name of the cell means variables as dependent variables in the MODEL statement. Use the CONTRAST statement to specify the contrast as you would in PROC GLM. The following statements perform the sample size analysis.
proc glmpower data=Exemplary; class Variety Exposure; model HeightOrig HeightNew = Variety | Exposure; weight Weight; contrast 'Exposure=1 vs Exposure=3' Exposure 1 0 -1; power stddev = 5 ntotal = 60 power = .; run;
Figure 44.4 shows the output.
Figure 44.4: Sample Size Analysis for More Complex Two-Way ANOVA
Fixed Scenario Elements | |
---|---|
Weight Variable | Weight |
Error Standard Deviation | 5 |
Total Sample Size | 60 |
Alpha | 0.05 |
Error Degrees of Freedom | 54 |
Computed Power | |||||
---|---|---|---|---|---|
Index | Dependent | Type | Source | Test DF | Power |
1 | HeightOrig | Effect | Variety | 1 | 0.672 |
2 | HeightOrig | Effect | Exposure | 2 | 0.911 |
3 | HeightOrig | Effect | Variety*Exposure | 2 | 0.217 |
4 | HeightOrig | Contrast | Exposure=1 vs Exposure=3 | 1 | 0.951 |
5 | HeightNew | Effect | Variety | 1 | 0.754 |
6 | HeightNew | Effect | Exposure | 2 | 0.633 |
7 | HeightNew | Effect | Variety*Exposure | 2 | 0.137 |
8 | HeightNew | Contrast | Exposure=1 vs Exposure=3 | 1 | 0.705 |
The power of the contrast of Exposure
levels 1 and 3 is about 0.95 for the original cell means scenario (HeightOrig
) and only 0.71 for the new one (HeightNew
). The power is higher for the test of Variety
, but lower for the tests of Exposure
and of Variety*Exposure
for the new cell means scenario compared to the original one. Note also for the HeightOrig
scenario that the power for the unbalanced design (Figure 44.4) compared to the balanced design (Figure 44.1) is slightly lower for the tests of Variety
and Exposure
, but slightly higher for the test of Variety*Exposure
.