Getting Started


Simple Two-Way ANOVA

This example demonstrates how to use PROC GLMPOWER to compute and plot power for each effect test in a two-way analysis of variance (ANOVA).

Suppose you are planning an experiment to study the effect of light exposure on the growth of two varieties of flowers. The planned data analysis is a two-way ANOVA with flower height (measured at two weeks) as the response and a model consisting of the effects of light exposure, flower variety, and their interaction. You want to calculate the power of each effect test using a balanced design with a total of 60 specimens (10 for each combination of exposure and variety) and ± = 0 . 05 for each test.

As a first step, create an exemplary data set describing your conjectures about the underlying population means. You believe that the mean flower height for each combination of variety and exposure level (i.e., for each design profile, or for each cell in the design) roughly follows Table 34.1.

Table 34.1: Mean Flower Height (in cm) by Variety and Exposure
 

Exposure

Variety

1

2

3

1

14

16

21

2

10

15

16

The following statements create a data set Exemplary containing these cell means.

  data Exemplary;   do Variety = 1 to 2;   do Exposure = 1 to 3;   input Height @@;   output;   end;   end;   datalines;   14 16 21   10 15 16   ;   run;  

You also conjecture that the error standard deviation is about 5 cm.

Use the DATA= option in the PROC GLMPOWER statement to specify Exemplary as the exemplary data set. Identify the class variables ( Variety and Exposure ) using the CLASS statement. Specify the model using the MODEL statement. Use the POWER statement to specify power as the result parameter and provide values for the other analysis parameters, error standard deviation and total sample size .

  proc glmpower data=Exemplary;   class Variety Exposure;   model Height = Variety  Exposure;   power   stddev = 5   ntotal = 60   power  = .;   run;  

The MODEL statement defines the full model including both main effects and the interaction. The POWER= option in the POWER statement identifies power as the result parameter with a missing value (POWER=.). The STDDEV= option specifies an error standard deviation of 5, and the NTOTAL= option specifies a total sample size of 60. The default value for the ALPHA= option sets the significance level to ± = 0 . 05.

Figure 34.1 shows the output.

start figure
  The GLMPOWER Procedure   Fixed Scenario Elements   Dependent Variable                Height   Error Standard Deviation               5   Total Sample Size                     60   Alpha                               0.05   Error Degrees of Freedom              54   Computed Power   Test   Index         Source           DF    Power   1    Variety                1    0.718   2    Exposure               2    0.957   3    Variety*Exposure       2    0.191  
end figure

Figure 34.1: Sample Size Analysis for Two-Way ANOVA

The power is about 0.72 for the test of the Variety effect. In other words, there is a probability of 0.72 that the test of the Variety effect will produce a significant result (given the assumptions for the means and error standard deviation). The power is 0.96 for the test of the Exposure effect and 0.19 for the interaction test.

Now, suppose you want to account for some of your uncertainty in conjecturing the true error standard deviation by evaluating the power at reasonable low and high values, 4 and 6.5. You also want to plot power for sample sizes between 30 and 90. The following statements perform the analysis:

  proc glmpower data=Exemplary;   class Variety Exposure;   model Height = Variety  Exposure;   power   stddev = 4 6.5   ntotal = 60   power  = .;   plot x=n min=30 max=90;   run;  

The PLOT statement with the X=N option requests a plot with sample size on the x-axis. (The result parameter, here power, is always plotted on the other axis.) The MIN= and MAX= options in the PLOT statement specify the sample size range.

Figure 34.2 shows the output, and Figure 34.3 shows the plot.

start figure
  The GLMPOWER Procedure   Fixed Scenario Elements   Dependent Variable                Height   Total Sample Size                     60   Alpha                               0.05   Error Degrees of Freedom              54   Computed Power   Std    Test   Index         Source          Dev      DF    Power   1    Variety              4.0       1    0.887   2    Variety              6.5       1    0.496   3    Exposure             4.0       2    0.996   4    Exposure             6.5       2    0.793   5    Variety*Exposure     4.0       2    0.280   6    Variety*Exposure     6.5       2    0.130  
end figure

Figure 34.2: Sample Size Analysis for Two-Way ANOVA with Input Ranges
click to expand
Figure 34.3: Plot of Power versus Sample Size for Two-Way ANOVA with Input Ranges

Figure 34.2 reveals that the power ranges from about 0.130 to 0.996 for the different effect tests and scenarios for standard deviation, with a sample size of 60. In Figure 34.3, the line style identifies the effect test, and the plotting symbol identifies the standard deviation. The locations of the plotting symbols identify actual computed powers; the curves are linear interpolations of these points. Note that the computed points in the plot occur at sample size multiples of 6, because there are 6 cells in the design (and by default, sample sizes are rounded to produce integer cell sizes).

Incorporating Contrasts, Unbalanced Designs, and Multiple Means Scenarios

Suppose you want to compute power for the two-way ANOVA described in Simple Two-Way ANOVA, but you want to

  • 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 34.2.

  • Test a contrast of Exposure comparing levels 1 and 3.

Table 34.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). Rename the original cell means scenario to HeightOrig .

  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   ;   run;  

In PROC GLMPOWER, specify the name of the weight variable 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' Exposure10-1;   power   stddev = 5   ntotal = 60   power  = .;   run;  

Figure 34.4 shows the output.

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 34.4 ) compared to the balanced design ( Figure 34.1) is slightly lower for the tests of Variety and Exposure, but slightly higher for the test of Variety*Exposure.

start figure
  The GLMPOWER Procedure   Fixed Scenario Elements   Weight Variable                   Weight   Error Standard Deviation               5   Total Sample Size                     60   Alpha                               0.05   Error Degrees of Freedom              54   Computed Power   Test   Index    Dependent       Type               Source               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  
end figure

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



SAS.STAT 9.1 Users Guide (Vol. 3)
SAS/STAT 9.1, Users Guide, Volume 3 (volume 3 ONLY)
ISBN: B0042UQTBS
EAN: N/A
Year: 2004
Pages: 105

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net