The GLMPOWER Procedure

Incorporating Contrasts, Unbalanced Designs, and Multiple Means Scenarios

(View the complete code for this example.)

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 49.2

  • test a contrast of Exposure comparing levels 1 and 3

Table 49.2: Additional Cell Means Scenario

 

Exposure

Variety

1

2

3

1

15

16

20

2

11

14

15


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 49.4 shows the output.

Figure 49.4: Sample Size Analysis for More Complex Two-Way ANOVA

The GLMPOWER Procedure

Fixed Scenario Elements
Weight VariableWeight
Error Standard Deviation5
Total Sample Size60
Alpha0.05
Error Degrees of Freedom54

Computed Power
IndexDependentTypeSourceTest DFPower
1HeightOrigEffectVariety10.672
2HeightOrigEffectExposure20.911
3HeightOrigEffectVariety*Exposure20.217
4HeightOrigContrastExposure=1 vs Exposure=310.951
5HeightNewEffectVariety10.754
6HeightNewEffectExposure20.633
7HeightNewEffectVariety*Exposure20.137
8HeightNewContrastExposure=1 vs Exposure=310.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 49.4) compared to the balanced design (Figure 49.1) is slightly lower for the tests of Variety and Exposure, but slightly higher for the test of Variety*Exposure.