Examples


Example 57.1. One-Way ANOVA

This example deals with the same situation as in Example 34.1 on page 1951 of Chapter 34, The GLMPOWER Procedure.

Hocking (1985, p. 109) describes a study of the effectiveness of electrolytes in reducing lactic acid buildup for long-distance runners. You are planning a similar study in which you will allocate five different fluids to runners on a 10-mile course and measure lactic acid buildup immediately after the race. The fluids consist of water and two commercial electrolyte drinks, EZDure and LactoZap, each prepared at two concentrations, low (EZD1 and LZ1) and high (EZD2 and LZ2).

You conjecture that the standard deviation of lactic acid measurements given any particular fluid is about 3.75, and that the expected lactic acid values will correspond roughly to those in Table 57.27. You are least familiar with the LZ1 drink and hence decide to consider a range of reasonable values for that mean.

Table 57.27: Mean Lactic Acid Buildup by Fluid

Water

EZD1

EZD2

LZ1

LZ2

35.6

33.7

30.2

29 or 28

25.9

You are interested in four different comparisons, shown in Table 57.28 with appropriate contrast coefficients.

Table 57.28: Planned Comparisons
 

Contrast Coefficients

Comparison

Water

EZD1

EZD2

LZ1

LZ2

Water versus electrolytes

4

ˆ’ 1

ˆ’ 1

ˆ’ 1

ˆ’ 1

EZD versus LZ

1

1

ˆ’ 1

ˆ’ 1

EZD1 versus EZD2

1

ˆ’ 1

LZ1 versus LZ2

1

ˆ’ 1

For each of these contrasts you want to determine the sample size required to achieve a power of 0.9 for detecting an effect with magnitude in accord with Table 57.27. You are not yet attempting to choose a single sample size for the study, but rather checking the range of sample sizes needed for individual contrasts. You plan to test each contrast at ± = 0.025. In the interests of reducing costs, you will provide twice as many runners with water as with any of the electrolytes; in other words, you will use a sample size weighting scheme of 2:1:1:1:1. Use the ONEWAYANOVA statement in the POWER procedure to compute the sample sizes. The statements required to perform this analysis are as follows :

  proc power;   onewayanova   groupmeans = 35.6  33.7  30.2  29 28  25.9   stddev = 3.75   groupweights = (21111)   alpha = 0.025   ntotal = .   power = 0.9   contrast = (4   1   1   1   1) (0 1 1   1   1)   (0  1   1  0  0) (0 0 0  1   1);   run;  

The NTOTAL= option with a missing value (.) indicates total sample size as the result parameter. The GROUPMEANS= option with values from Table 57.27 specifies your conjectures for the means. With only one mean varying (the LZ1 mean), the crossed notation is simpler, showing scenarios for each group mean separated by a vertical bar (). See the Specifying Value Lists in Analysis Statements section on page 3490 for more details on crossed and matched notations for grouped values. The contrasts in Table 57.28 are specified with the CONTRAST option, using the matched notation with each contrast enclosed in parentheses. The STDDEV=, ALPHA=, and POWER= options specify the error standard deviation, significance level, and power. The GROUPWEIGHTS= option specifies the weighting schemes. Default values for the NULL= and SIDES= options specify a 2-sided t test of the contrast equal to 0. See Output 57.1.1 for the output.

Output 57.1.1: Sample Sizes for One-Way ANOVA Contrasts
start example
  The POWER Procedure   Single DF Contrast in One-Way ANOVA   Fixed Scenario Elements   Method                        Exact   Alpha                         0.025   Standard Deviation             3.75   Group Weights             2 1 1 1 1   Nominal Power                   0.9   Number of Sides                   2   Null Contrast Value               0   Computed N Total   Actual      N   Index -----Contrast----- -------------Means-------------   Power  Total   1   4   1   1   1   1  35.6   33.7   30.2   29   25.9   0.947     30   2   4   1   1   1   1  35.6   33.7   30.2   28   25.9   0.901     24   3   0  1   1   1   1   35.6   33.7   30.2   29   25.9   0.929     60   4   0  1   1   1   1   35.6   33.7   30.2   28   25.9   0.922     48   5   0  1   1   0   0   35.6   33.7   30.2   29   25.9   0.901    174   6   0  1   1   0   0   35.6   33.7   30.2   28   25.9   0.901    174   7   0  0   0   1   1   35.6   33.7   30.2   29   25.9   0.902    222   8   0  0   0   1   1   35.6   33.7   30.2   28   25.9   0.902    480  
end example
 

The sample sizes in Output 57.1.1 range from 24 for the comparison of water versus electrolytes to 480 for the comparison of LZ1 versus LZ2, both assuming the smaller LZ1 mean. The sample size for the latter comparison is relatively large because the small mean difference of 28 ˆ’ 25 . 9 = 2 . 1 is hard to detect.

The Nominal Power of 0.9 in the Fixed Scenario Elements table in Output 57.1.1 represents the input target power, and the Actual Power column in the Computed N Total table is the power at the sample size (N Total) adjusted to achieve the specified sample weighting. Note that all of the sample sizes are rounded up to multiples of 6 to preserve integer group sizes (since the group weights add up to 6). You can use the NFRACTIONAL option in the ONEWAYANOVA statement to compute raw fractional sample sizes.

Suppose you want to plot the required sample size for the range of power values from 0.5 to 0.95. First, define the analysis by specifying the same statements as before, but add the PLOTONLY option to the PROC POWER statement to disable the nongraphical results. Next, specify the PLOT statement with X=POWER to request a plot with power on the x-axis. (The result parameter, here sample size, is always plotted on the other axis.) Use the MIN= and MAX= options in the PLOT statement to specify the power range.

  proc power plotonly;   onewayanova   groupmeans = 35.6  33.7  30.2  29 28  25.9   stddev = 3.75   groupweights = (2 1 1 1 1)   alpha = 0.025   ntotal = .   power = 0.9   contrast = (4   1   1   1   1) (0 1 1   1   1)   (0  1   1  0  0) (0 0 0  1   1);   plot x=power min=.5 max=.95;   run;  

See Output 57.1.2 for the resulting plot.

Output 57.1.2: Plot of Sample Size versus Power for One-Way ANOVA Contrasts
start example
click to expand
end example
 

In Output 57.1.2, the line style identifies the contrast, and the plotting symbol identifies the group means scenario. The plot shows that the required sample size is highest for the (0 0 0 1 -1) contrast, corresponding to the test of LZ1 versus LZ2 that was previously found to require the most resources, in either cell means scenario.

Note that some of the plotted points in Output 57.1.2 are unevenly spaced . This is because the plotted points are the rounded sample size results at their corresponding actual power levels. The range specified with the MIN= and MAX= values in the PLOT statement correspond to nominal power levels. In some cases, actual power is substantially higher than nominal power. To obtain plots with evenly spaced points (but with fractional sample sizes at the computed points), you can use the NFRACTIONAL option in the analysis statement preceding the PLOT statement.

Finally, suppose you want to plot the power for the range of sample sizes you will likely consider for the study (the range of 24 to 480 that achieves 0.9 power for different comparisons). In the ONEWAYANOVA statement, identify power as the result (POWER=.), and specify NTOTAL=24. The following statements produce the plot:

  proc power plotonly;   onewayanova   groupmeans = 35.6  33.7  30.2  29 28  25.9   stddev = 3.75   groupweights = (2 1 1 1 1)   alpha = 0.025   ntotal = 24   power = .   contrast = (4   1   1   1   1) (0 1 1   1   1)   (0  1   1  0  0) (0 0 0  1   1);   plot x=n min=24 max=480;   run;  

The X=N option in the PLOT statement requests a plot with sample size on the x-axis.

Note that the value specified with the NTOTAL=24 option is not used. It is overridden in the plot by the MIN= and MAX= options in the PLOT statement, and the PLOTONLY option in the PROC POWER statement disables nongraphical results. But the NTOTAL= option (along with a value) is still needed in the ONEWAYANOVA statement as a placeholder, to identify the desired parameterization for sample size.

See Output 57.1.3 for the plot.

Output 57.1.3: Plot of Power versus Sample Size for One-Way ANOVA Contrasts
start example
click to expand
end example
 

Although Output 57.1.2 and Output 57.1.3 surface essentially the same computations for practical power ranges, they each provide a different quick visual assessment. Output 57.1.2 reveals the range of required sample sizes for powers of interest, and Output 57.1.3 reveals the range of achieved powers for sample sizes of interest.

Example 57.2. The Sawtooth Power Function in Proportion Analyses

For many common statistical analyses, the power curve is monotonically increasing: the more samples you take, the more power you achieve. However, in statistical analyses of discrete data, such as tests of proportions , the power curve is often nonmonotonic. A small increase in sample size can result in a decrease in power, a decrease that is sometimes substantial. The explanation is that the actual significance level (in other words, the achieved Type 1 error rate) for discrete tests strays below the target level and varies with sample size. The power loss from a decrease in the Type 1 error rate may outweigh the power gain from an increase in sample size. The example discussed in this section demonstrates this sawtooth phenomenon . For additional discussion on the topic, refer to Chernick and Liu (2002).

Suppose you have a new scheduling system for an airline, and you want to determine how many flights you must observe to have at least an 80% chance of establishing an improvement in the proportion of late arrivals on a specific travel route. You will use a 1-sided exact binomial proportion test with a null proportion of 30%, the frequency of late arrivals under the previous scheduling system, and a nominal significance level of ± = 0.05. Well-supported predictions estimate the new late arrival rate to be about 20%, and you will base your sample size determination on this assumption.

The POWER procedure does not currently compute exact sample size directly for the exact binomial test. But you can get an initial estimate by computing the approximate sample size required for a z test. Use the ONESAMPLEFREQ statement in the POWER procedure with TEST=Z and METHOD=NORMAL to compute the approximate sample size to achieve a power of 0.8 using the z test. The following statements perform the analysis:

  proc power;   onesamplefreq test=z method=normal   sides          = 1   alpha          = 0.05   nullproportion = 0.3   proportion     = 0.2   ntotal         = .   power          = 0.8;   run;  

The NTOTAL= option with a missing value (.) indicates sample size as the result parameter. The SIDES=1 option specifies a 1-sided test. The ALPHA=, NULLPROPORTION=, and POWER= options specify the significance level of 0.05, null value of 0.3, and target power of 0.8. The PROPORTION= option specifies your conjecture of 0.3 for the true proportion.

The results, shown in Output 57.2.1, indicate that you need to observe about N =119 flights to have an 80% chance of rejecting the hypothesis of a late arrival proportion of 30% or higher, if the true proportion is 20%, using the z test. A similar analysis ( Output 57.2.2) reveals an approximate sample size of N =129 for the z test with continuity correction, which performed using TEST=ADJZ:

Output 57.2.1: Approximate Sample Size for z Test of a Proportion
start example
  The POWER Procedure   Z Test for Binomial Proportion   Fixed Scenario Elements   Method                 Normal approximation   Number of Sides                           1   Null Proportion                         0.3   Alpha                                  0.05   Binomial Proportion                     0.2   Nominal Power                           0.8   Computed N Total   Actual        N   Power    Total   0.800      119  
end example
 
  proc power;   onesamplefreq test=adjz method=normal   sides          = 1   alpha          = 0.05   nullproportion = 0.3   proportion     = 0.2   ntotal         = .   power          = 0.8;   run;  
Output 57.2.2: Approximate Sample Size for z Test with Continuity Correction
start example
  The POWER Procedure   Z Test for Binomial Proportion with Continuity Adjustment   Fixed Scenario Elements   Method                 Normal approximation   Number of Sides                           1   Null Proportion                         0.3   Alpha                                  0.05   Binomial Proportion                     0.2   Nominal Power                           0.8   Computed N Total   Actual        N   Power    Total   0.801      129  
end example
 

Based on the approximate sample size results, you decide to explore the power of the exact binomial test for sample sizes between 110 and 140. The following statements produce the plot:

  proc power plotonly;   onesamplefreq test=exact   sides          = 1   alpha          = 0.05   nullproportion = 0.3   proportion     = 0.2   ntotal         = 119   power          = .;   plot x=n min=110 max=140 step=1   yopts=(ref=.8) xopts=(ref=119 129);   run;  

The TEST=EXACT option in the ONESAMPLEFREQ statement specifies the exact binomial test, and the missing value (.) for the POWER= option indicates power as the result parameter. The PLOTONLY option in the PROC POWER statement disables nongraphical output. The PLOT statement with X=N requests a plot with sample size on the x-axis. The MIN= and MAX= options in the PLOT statement specify the sample size range. The YOPTS=(REF=) and XOPTS=(REF=) options add reference lines to highlight the approximate sample size results. The STEP=1 option produces a point at each integer sample size. The sample size value specified with the NTOTAL= option in the ONESAMPLEFREQ statement is overridden by the MIN= and MAX= options in the PLOT statement. Output 57.2.3 shows the plot.

Output 57.2.3: Plot of Power versus Sample Size for Exact Binomial Test
start example
click to expand
end example
 

Note the sawtooth pattern in Output 57.2.3. Although the power surpasses the target level of 0.8 at N =119, it decreases to 0.79 with N =120 and further to 0.76 with N =122 before rising again to 0.81 with N =123. Not until N =130 does the power stay above the 0.8 target. Thus, a more conservative sample size recommendation of 130 might be appropriate, depending on the precise goals of the sample size determination.

In addition to considering alternative sample sizes, you may also want to assess the sensitivity of the power to inaccuracies in assumptions about the true proportion. The following statements produce a plot including true proportion values of 0.18 and 0.22. They are identical to the previous statements except for the additional true proportion values specified with the PROPORTION= option in the ONESAMPLEFREQ statement.

  proc power plotonly;   onesamplefreq test=exact   sides          = 1   alpha          = 0.05   nullproportion = 0.3   proportion     = 0.18 0.2 0.22   ntotal         = 119   power          = .;   plot x=n min=110 max=140 step=1   yopts=(ref=.8) xopts=(ref=119 129);   run;  

Output 57.2.4 shows the plot.

Output 57.2.4: Plot for Assessing Sensitivity to True Proportion Value
start example
click to expand
end example
 

The plot reveals a dramatic sensitivity to the true proportion value. For N =119, the power is about 0.92 if the true proportion is 0.22, and as low as 0.62 if the proportion is 0.18. Note also that the power jumps occur at the same sample sizes in all three curves; the curves are only shifted and stretched vertically. This is because spikes and valleys in power curves are invariant to the true proportion value; they are due to changes in the critical value of the test.

A closer look at some ancillary output from the analysis sheds light on this property of the sawtooth pattern. You can add an ODS OUTPUT statement to save the plot content corresponding to Output 57.2.3 toadataset:

  proc power plotonly;   ods output plotcontent=PlotData;   onesamplefreq test=exact   sides          = 1   alpha          = 0.05   nullproportion = 0.3   proportion     = 0.2   ntotal         = 119   power          = .;   plot x=n min=110 max=140 step=1   yopts=(ref=.8) xopts=(ref=119 129);   run;  

The PlotData data set contains parameter values for each point in the plot. The parameters including underlying characteristics of the putative test. The following statements print the critical value and actual significance level along with sample size and power.

  proc print data=PlotData;   var NTotal LowerCritVal Alpha Power;   run;  

Output 57.2.5 shows the plot data.

Output 57.2.5: Numerical Content of Plot
start example
  Lower   Obs   NTotal     CritVal  Alpha  Power   1     110         24   0.0356  0.729   2     111         24   0.0313  0.713   3     112         25   0.0446  0.771   4     113         25   0.0395  0.756   5     114         25   0.0349  0.741   6     115         26   0.0490  0.795   7     116         26   0.0435  0.781   8     117         26   0.0386  0.767   9     118         26   0.0341  0.752   10     119         27   0.0478  0.804   11     120         27   0.0425  0.790   12     121         27   0.0377  0.776   13     122         27   0.0334  0.762   14     123         28   0.0465  0.812   15     124         28   0.0414  0.799   16     125         28   0.0368  0.786   17     126         28   0.0327  0.772   18     127         29   0.0453  0.820   19     128         29   0.0404  0.807   20     129         29   0.0359  0.794   21     130         30   0.0493  0.838   22     131         30   0.0441  0.827   23     132         30   0.0394  0.815   24     133         30   0.0351  0.803   25     134         31   0.0480  0.845   26     135         31   0.0429  0.834   27     136         31   0.0384  0.823   28     137         31   0.0342  0.811   29     138         32   0.0466  0.851   30     139         32   0.0418  0.841   31     140         32   0.0374  0.830  
end example
 

Note that whenever the critical value changes, the actual ± jumps up to a value close to the nominal ± =0.05, and the power also jumps up. Then while the critical value stays constant, the actual ± and power slowly decrease. The critical value is independent of the true proportion value. So, you can achieve a locally maximal power by choosing a sample size corresponding to a spike on the sawtooth curve, and this choice is locally optimal regardless of the unknown value of the true proportion. Locally optimal sample sizes in this case include 115, 119, 123, 127, 130, and 134.

As a point of interest, the power does not always jump sharply and decrease gradually. The shape of the sawtooth depends on the direction of the test and the location of the null proportion relative to 0.5. For example, if the direction of the hypothesis in this example is reversed (by switching true and null proportion values) so that the rejection region is in the upper tail, then the power curve exhibits sharp decreases and gradual increases . The following statements are similar to those producing the plot in Output 57.2.3 but with values of the PROPORTION= and NULLPROPORTION= options switched.

  proc power plotonly;   onesamplefreq test=exact   sides          = 1   alpha          = 0.05   nullproportion = 0.2   proportion     = 0.3   ntotal         = 119   power          = .;   plot x=n min=110 max=140 step=1;   run;  

The resulting plot is shown in Output 57.2.6.

Output 57.2.6: Plot of Power versus Sample Size for Another 1-Sided Test
start example
click to expand
end example
 

Finally, 2-sided tests can lead to even more irregular power curve shapes , since changes in lower and upper critical values affect the power in different ways. The following statements produce a plot of power versus sample size for the scenario of a 2-sided test with high alpha and a true proportion close to the null value.

  proc power plotonly;   onesamplefreq test=exact   sides          = 2   alpha          = 0.2   nullproportion = 0.1   proportion     = 0.09   ntotal         = 10   power          = .;   plot x=n min=2 max=100 step=1;   run;  

The resulting plot is shown in Output 57.2.7.

Output 57.2.7: Plot of Power versus Sample Size for a 2-Sided Test
start example
click to expand
end example
 

Due to the irregular shapes of power curves for proportion tests, the question Which sample size should I use? is often insufficient. A sample size solution produced directly in PROC POWER reveals the smallest possible sample size to achieve your target power. But as the Examples in this section demonstrate , it is helpful to consult graphs for answers to questions such as the following:

  • Which sample size will guarantee that all higher sample sizes also achieve my target power?

  • Given a candidate sample size, can I increase it slightly to achieve locally maximal power, or perhaps even decrease it and get higher power?

Example 57.3. Simple AB/BA Crossover Designs

Crossover trials are experiments in which each subject is given a sequence of different treatments. They are especially common in clinical trials for medical studies. The reduction in variability from taking multiple measurements on a subject allows for more precise treatment comparisons. The simplest such design is the AB/BA crossover, in which each subject receives each of two treatments in a randomized order.

Under certain simplifying assumptions, you can test the treatment difference in an AB/BA crossover trial using either a paired or two-sample t test (or equivalence test, depending on the hypothesis). This example will demonstrate when and how you can use the PAIREDMEANS statement in PROC POWER to perform power analyses for AB/BA crossover designs.

Senn (1993, Chapter 3) discusses a study comparing the effects of two bronchodilator medications in treatment of asthma, using an AB/BA crossover design. Suppose you want to plan a similar study comparing two new medications, Xilodol and Brantium. Half of the patients would be assigned to sequence AB, getting a dose of Xilodol in the first treatment period, a wash-out period of one week, and then a dose of Brantium in the second treatment period. The other half would be assigned to sequence BA, following the same schedule but with the drugs reversed. In each treatment period you would administer the drugs in the morning and then measure peak expiratory flow (PEF) at the end of the day, with higher PEF representing better lung function.

You conjecture that the mean and standard deviation of PEF are about µ A = 310 and ƒ A = 40 for Xilodol and µ B = 330 and ƒ B = 55 for Brantium, and that each pair of measurements on the same subject will have a correlation of about 0.3. You want to compute the power of both 1-sided and 2-sided tests of mean difference, with a significance level of ± =0 . 01, for a sample size of 100 patients and also plot the power for a range of 50 to 200 patients. Note that the allocation ratio of patients to the two sequences is irrelevant in this analysis.

The choice of statistical test depends on which assumptions are reasonable. One possibility is a t test. A paired or two-sample t test is valid when there is no carryover effect and no interactions between patients, treatments, and periods. See Senn (1993, Chapter 3) for more details. The choice between a paired or a two-sample test depends on what you assume about the period effect. If you assume no period effect, then a paired t test is the appropriate analysis for the design, with the first member of each pair being the Xilodol measurement (regardless of which sequence the patient belongs to). Otherwise the two-sample t test approach is called for, since this analysis adjusts for the period effect using an extra degree of freedom.

Suppose you assume no period effect. Then you can use the PAIREDMEANS statement in PROC POWER with the TEST=DIFF option to perform a sample size analysis for the paired t test. Indicate power as the result parameter by specifying the POWER= option with a missing value (.). Specify the conjectured means and standard deviations for each drug using the PAIREDMEANS= and PAIREDSTDDEVS= options and the correlation using the CORR= option. Specify both 1- and 2-sided tests using the SIDES= option, the significance level using the ALPHA= option, and the sample size (in terms of number of pairs) using the NPAIRS= option. Generate a plot of power versus sample size by specifying the PLOT statement with X=N to request a plot with sample size on the x-axis. (The result parameter, here power, is always plotted on the other axis.) Use the MIN= and MAX= options in the PLOT statement to specify the sample size range (as numbers of pairs).

The following statements perform the sample size analysis.

  proc power;   pairedmeans test=diff   pairedmeans   = (330 310)   pairedstddevs = (40 55)   corr          = 0.3   sides         = 1 2   alpha         = 0.01   npairs        = 100   power         = .;   plot x=n min=50 max=200;   run;  

Default values for the NULLDIFF= and DIST= options specify a null mean difference of 0 and the assumption of normally distributed data. The output is shown in Output 57.3.1 and Output 57.3.2.

Output 57.3.1: Power for Paired t Analysis of Crossover Design
start example
  The POWER Procedure   Paired t Test for Mean Difference   Fixed Scenario Elements   Distribution                  Normal   Method                         Exact   Alpha                           0.01   Mean 1                           330   Mean 2                           310   Standard Deviation 1              40   Standard Deviation 2              55   Correlation                      0.3   Number of Pairs                  100   Null Difference                    0   Computed Power   Index    Sides    Power   1      1      0.865   2      2      0.801  
end example
 
Output 57.3.2: Plot of Power versus Sample Size for Paired t Analysis of Crossover Design
start example
click to expand
end example
 

The Computed Power table in Output 57.3.1 shows that the power with 100 patients is about 0.8 for the 2-sided test and 0.87 for the 1-sided test with the alternative of larger Brantium mean. In Output 57.3.2, the line style identifies the number of sides of the test. The plotting symbols identify locations of actual computed powers; the curves are linear interpolations of these points. The plot demonstrates how much higher the power is for the 1-sided test than the 2-sided test for the range of sample sizes.

Suppose now that instead of detecting a difference between Xilodol and Brantium, you want to establish that they are similar, in particular, that the absolute mean PEF difference is at most 35. You might consider this goal if, for example, one of the drugs has fewer side effects and if a difference of no more than 35 is considered clinically small. Instead of a standard t test, you would conduct an equivalence test of the treatment mean difference for the two drugs. You would test the hypothesis that the true difference is less than -35 or more than 35 against the alternative that the mean difference is between -35 and 35, using an additive model and a two one-sided tests (TOST) analysis.

Assuming no period effect, you can use the PAIREDMEANS statement with the TEST=EQUIV_ DIFF option to perform a sample size analysis for the paired equivalence test. Indicate power as the result parameter by specifying the POWER= option with a missing value (.). Use the LOWER= and UPPER= options to specify the equivalence bounds of -35 and 35. Use the PAIREDMEANS=, PAIREDSTDDEVS=, CORR=, and ALPHA= options in the same way as in the t test at the beginning of this example to specify the remaining parameters.

The following statements perform the sample size analysis.

  proc power;   pairedmeans test=equiv_add   lower         =   35   upper         = 35   pairedmeans   = (330 310)   pairedstddevs = (40 55)   corr          = 0.3   alpha         = 0.01   npairs        = 100   power         = .;   run;  

The default option DIST=NORMAL specifies an assumption of normally distributed data. The output is shown in Output 57.3.3.

Output 57.3.3: Power for Paired Equivalence Test for Crossover Design
start example
  The POWER Procedure   Equivalence Test for Paired Mean Difference   Fixed Scenario Elements   Distribution                     Normal   Method                            Exact   Lower Equivalence Bound   35   Upper Equivalence Bound              35   Alpha                              0.01   Reference Mean                      330   Treatment Mean                      310   Standard Deviation 1                 40   Standard Deviation 2                 55   Correlation                         0.3   Number of Pairs                     100   Computed Power   Power   0.598  
end example
 

The power for the paired equivalence test with 100 patients is about 0.6.

Example 57.4. Noninferiority Test with Lognormal Data

The typical goal in noninferiority testing is to conclude that a new treatment or process or product is not appreciably worse than some standard. This is accomplished by convincingly rejecting a 1-sided null hypothesis that the new treatment is appreciably worse than the standard. When designing such studies, investigators must define precisely what constitutes appreciably worse.

You can use the POWER procedure for sample size analyses for a variety of noninferiority tests, by specifying custom, 1-sided null hypotheses for common tests. This example illustrates the strategy (often called Blackwelder s scheme, Blackwelder 1982) by comparing the means of two independent lognormal samples. The logic applies to one-sample, two-sample, and paired-sample problems involving normally distributed measures and proportions.

Suppose you are designing a study hoping to show that a new (less expensive) manufacturing process does not produce appreciably more pollution than the current process. Quantifying appreciably worse as 10%, you seek to show that the mean pollutant level from the new process is less than 110% of that from the current process. In standard hypothesis testing notation, you seek to reject

click to expand

in favor of

click to expand

This is described graphically in Figure 57.8. Mean ratios below 100% are better levels for the new process; a ratio of 100% indicates absolute equivalence; ratios of 100 “110% are tolerably worse; and ratios exceeding 110% are appreciably worse. 100% 110%

click to expand
Figure 57.8: Hypotheses for the Pollutant Study

An appropriate test for this situation is the common two-group t test on log-transformed data. The hypotheses become

click to expand

Measurements of the pollutant level will be taken using laboratory models of the two processes and will be treated as independent lognormal observations with a coefficient of variation ( ƒ / µ ) between 0.5 and 0.6 for both processes. You will end up with 300 measurements for the current process and 180 for the new one. It is important to avoid a Type 1 error here, so you set the Type 1 error rate to 0.01. Your theoretical work suggests that the new process will actually reduce the pollutant by about 10% (to 90% of current), but you need to compute and graph the power of the study if the new levels are actually between 70% and 120% of current levels.

Implement the sample size analysis using the TWOSAMPLEMEANS statement in PROC POWER with the TEST=RATIO option, Indicate power as the result parameter by specifying the POWER= option with a missing value (.). Specify a series of scenarios for the mean ratio between 0.7 and 1.2 using the MEANRATIO= option. Use the NULLRATIO= option to specify the null mean ratio of 1.10. Specify SIDES=L to indicate a 1-sided test with the alternative hypothesis stating that the mean ratio is lower than the null value. Specify the significance level, scenarios for the coefficient of variation, and the group sample sizes using the ALPHA=, CV=, and GROUPNS= options. Generate a plot of power versus mean ratio by specifying the PLOT statement with X=EFFECT to request a plot with mean ratio on the x-axis. (The result parameter, here power, is always plotted on the other axis.) Use the STEP= option in the PLOT statement to specify an interval of 0.05 between computed points in the plot.

The following statements perform the desired analysis.

  proc power;   twosamplemeans test=ratio   meanratio = 0.7 to 1.2 by 0.1   nullratio = 1.10   sides     = L   alpha     = 0.01   cv        = 0.5 0.6   groupns   = (300 180)   power     = .;   plot x=effect step=0.05;   run;  

Note the use of SIDES=L, which forces computations for cases that need a rejection region that is opposite to the one providing the most one-tailed power; in this case, it is the lower tail. Such cases will show power that is less than the prescribed Type 1 error rate. The default option DIST=LOGNORMAL specifies the assumption of lognormally distributed data. The default MIN= and MAX= options in the plot statement specify an x-axis range identical to the effect size range in the TWOSAMPLEMEANS statement (mean ratios between 0.7 and 1.2).

See the output in Output 57.4.1 and Output 57.4.2.

Output 57.4.1: Power for Noninferiority Test of Ratio
start example
  The POWER Procedure   Two-sample t Test for Mean Ratio   Fixed Scenario Elements   Distribution                    Lognormal   Method                              Exact   Number of Sides                         L   Null Geometric Mean Ratio             1.1   Alpha                                0.01   Group 1 Sample Size                   300   Group 2 Sample Size                   180   Computed Power   Geo   Mean   Index    Ratio      CV    Power   1      0.7     0.5    >.999   2      0.7     0.6    >.999   3      0.8     0.5    >.999   4      0.8     0.6    >.999   5      0.9     0.5    0.985   6      0.9     0.6    0.933   7      1.0     0.5    0.424   8      1.0     0.6    0.306   9      1.1     0.5    0.010   10      1.1     0.6    0.010   11      1.2     0.5    <.001   12      1.2     0.6    <.001  
end example
 
Output 57.4.2: Plot of Power versus Mean Ratio for Noninferiority Test
start example
click to expand
end example
 

The Computed Power table in Output 57.4.1 shows that power exceeds 0.90 if the true mean ratio is 90% or less, as surmised. But power is unacceptably low (0.31 “0.42) if the processes happen to be truly equivalent. Note that the power is identical to the alpha level (0.01) if the true mean ratio is 1.10 and below 0.01 if the true mean ratio is appreciably worse (> 110%). In Output 57.4.2, the line style identifies the coefficient of variation. The plotting symbols identify locations of actual computed powers; the curves are linear interpolations of these points.

Example 57.5. Multiple Regression and Correlation

You are working with a team of preventive cardiologists investigating whether elevated serum homocysteine levels are linked to atherosclerosis (plaque buildup in coronary arteries). The planned analysis is an ordinary least squares regression to assess the relationship between total homocysteine level (tHcy) and a plaque burden index (PBI), adjusting for six other variables : age, gender, plasma levels of folate, vitamins B 6 and B 12 , and a serum cholesterol index. You will regress PBI on tHcy and the six other predictors (plus the intercept) and use a Type III F test to assess whether tHcy is a significant predictor after adjusting for the others. You wonder whether 100 subjects will provide adequate statistical power.

This is a correlational study at a single time. Subjects will be screened so that about half will have had a heart problem. All eight variables will be measured during one visit. Most clinicians are familiar with simple correlations between two variables, so you decide to pose the statistical problem in terms of estimating and testing the partial correlation between X 1 = tHcy and Y = PBI, controlling for the six other predictor variables . This greatly simplifies matters, especially the elicitation of the conjectured effect.

You use partial regression plots like that shown in Figure 57.9 to teach the team that the partial correlation between PBI and tHcy is the correlation of two sets of residuals obtained from ordinary regression models, one from regressing PBI on the six covariates and the other from regressing tHcy on the same covariates. Thus each subject has expected tHcy and PBI values based on the six covariates. The cardiologists believe that subjects who are relatively higher than expected on tHcy will also be relatively higher than expected on PBI. The partial correlation quantifies that adjusted association just like a standard simple correlation does with the unadjusted linear association between two variables.

click to expand
Figure 57.9: Partial Regression Plot

Based on previously published studies of various coronary risk factors and after viewing a set of scatterplots showing various correlations, the team surmises that the true partial correlation is likely to be at least 0.35.

You want to compute the statistical power for a sample size of N = 100, using ± = 0.05. You also want to plot power for sample sizes between 50 and 150. Use the MULTREG statement to compute the power and the PLOT statement to produce the graph. Since the predictors are observed rather than fixed in advanced, and a joint multivariate normal assumption seems tenable, use MODEL=RANDOM. The following statements perform the power analysis:

  proc power;   multreg   model = random   nfullpredictors = 7   ntestpredictors = 1   partialcorr = 0.35   ntotal = 100   power = .;   plot x=n min=50 max=150;   run;  

The POWER=. option identifies power as the parameter to compute. The NFULLPREDICTORS= option specifies 7 total predictors (not including the intercept), and the NTESTPREDICTORS= option indicates that 1 of those predictors is being tested . The PARTIALCORR= and NTOTAL= options specify the partial correlation and sample size, respectively. The default value for the ALPHA= option sets the significance level to 0.05. The X=N option in the plot statement requests a plot of sample size on the x-axis, and the MIN= and MAX= options specify the sample size range.

Output 57.5.1 shows the output, and Output 57.5.2 shows the plot.

Output 57.5.1: Power Analysis for Multiple Regression
start example
  The POWER Procedure   Type III F Test in Multiple Regression   Fixed Scenario Elements   Method                                       Exact   Model                                     Random X   Number of Predictors in Full Model               7   Number of Test Predictors                        1   Partial Correlation                           0.35   Total Sample Size                              100   Alpha                                         0.05   Computed Power   Power   0.939  
end example
 
Output 57.5.2: Plot of Power versus Sample Size for Multiple Regression
start example
click to expand
end example
 

For the sample size N = 100, the study is almost balanced with respect to Type 1 and Type 2 error rates, with ± = 0.05 and ² = 1 - 0.937 = 0.063. The study thus seems well designed at this sample size.

Now suppose that in a follow-up meeting with the cardiologists, you discover that their specific intent is to demonstrate that the (partial) correlation between PBI and tHcy is greater than 0.2. You suggest changing the planned data analysis to a 1-sided Fisher s z test with a null correlation of 0.2. The following statements perform a power analysis for this test:

  proc power;   onecorr dist=fisherz   npvars = 6   corr = 0.35   nullcorr = 0.2   sides = 1   ntotal = 100   power = .;   run;  

The DIST=FISHERZ option in the ONECORR statement specifies Fisher s z test. The NPVARS= option specifies that 6 additional variables are adjusted for in the partial correlation. The CORR= option specifies the conjectured correlation of 0.35, and the NULLCORR= option indicates the null value of 0.2. The SIDES= option specifies a 1-sided test.

Output 57.5.3 shows the output.

Output 57.5.3: Power Analysis for Fisher s z Test
start example
  The POWER Procedure   Fishers z Test for Pearson Correlation   Fixed Scenario Elements   Distribution                          Fishers z transformation of r   Method                                          Normal approximation   Number of Sides                                                    1   Null Correlation                                                 0.2   Number of Variables Partialled Out                                 6   Correlation                                                     0.35   Total Sample Size                                                100   Nominal Alpha                                                   0.05   Computed Power   Actual   Alpha    Power   0.05    0.466  
end example
 

The power for Fisher s z test is less than 50%, the decrease being mostly due to the smaller effect size (relative to the null value). When asked for a recommendation for a new sample size goal, you compute the required sample size to achieve a power of 0.95 (to balance Type 1 and Type 2 errors) and 0.85 (a threshold deemed to be minimally acceptable to the team). The following statements perform the sample size determination:

  proc power;   onecorr dist=fisherz   npvars = 6   corr = 0.35   nullcorr = 0.2   sides = 1   ntotal = .   power = 0.85 0.95;   run;  

The NTOTAL=. option identifies sample size as the parameter to compute, and the POWER= option specifies the target powers.

The results in Output 57.5.4 reveal a required sample size of 417 to achieve a power of 0.95 and 280 to achieve a power of 0.85.

Output 57.5.4: Sample Size Determination for Fisher s z Test
start example
  The POWER Procedure   Fishers z Test for Pearson Correlation   Fixed Scenario Elements   Distribution                          Fishers z transformation of r   Method                                          Normal approximation   Number of Sides                                                    1   Null Correlation                                                 0.2   Number of Variables Partialled Out                                 6   Correlation                                                     0.35   Nominal Alpha                                                   0.05   Computed N Total   Nominal    Actual    Actual        N   Index      Power     Alpha     Power    Total   1       0.85      0.05     0.850      280   2       0.95      0.05     0.950      417  
end example
 

Example 57.6. Comparing Two Survival Curves

You are consulting for a clinical research group planning a trial to compare survival rates for proposed and standard cancer treatments. The planned data analysis is a log-rank test to nonparametrically compare the overall survival curves for the two treatments. Your goal is to determine an appropriate sample size to achieve a power of 0.8 for a 2-sided test with ± = 0.05 using a balanced design.

The survival curve for patients on the standard treatment is well-known to be approximately exponential with a median survival time of five years . The research group conjectures that the new proposed treatment will yield a (nonexponential) survival curve similar to the dashed line in Output 57.6.1. Patients will be accrued uniformly over two years and then followed for an additional three years past the accrual period. Some loss to follow-up is expected, with roughly exponential rates that would result in about 50% loss with the standard treatment within 10 years. The loss to follow-up with the proposed treatment is more difficult to predict, but 50% loss would expected to occur sometime between years 5 and 20.

Output 57.6.1: Survival Curves
start example
click to expand
end example
 

Use the TWOSAMPLESURVIVAL statement with the TEST=LOGRANK option to compute the required sample size for the log-rank test. The following statements perform the analysis:

  proc power;   twosamplesurvival test=logrank   curve("Standard") = 5 : 0.5   curve("Proposed") = (1 to 5 by 1):(0.95 0.9 0.75 0.7 0.6)   groupsurvival = "Standard"  "Proposed"   accrualtime = 2   followuptime = 3   groupmedlosstimes = 10  20 5   power = 0.8   npergroup = .;   run;  

The CURVE= option defines the two survival curves. The Standard curve has only one point, specifying an exponential form with a survival probability of 0.5 at year 5. The Proposed curve is a piecewise linear curve definedbythefive points shown in Output 57.6.1. The GROUPSURVIVAL= option assigns the survival curves to the two groups, and the ACCRUALTIME= and FOLLOWUPTIME= options specify the accrual and follow-up times. The GROUPMEDLOSSTIMES= option specifies the years at which 50% loss is expected to occur. The POWER= option specifies the target power, and the NPERGROUP=. option identifies sample size per group as the parameter to compute. Default values for the SIDES= and ALPHA= options specify a 2-sided test with ± = 0.05.

Output 57.6.2 shows the results.

Output 57.6.2: Sample Size Determination for Log-Rank Test
start example
  The POWER Procedure   Log-Rank Test for Two Survival Curves   Fixed Scenario Elements   Method                          Lakatos normal approximation   Accrual Time                                               2   Follow-up Time                                             3   Group 1 Survival Curve                              Standard   Form of Survival Curve 1                         Exponential   Group 2 Survival Curve                              Proposed   Form of Survival Curve 2                    Piecewise Linear   Group 1 Median Loss Time                                  10   Nominal Power                                            0.8   Number of Sides                                            2   Number of Time Sub-Intervals                              12   Alpha                                                   0.05   Computed N Per Group   Median   Loss    Actual    N Per   Index    Time 2     Power    Group   1        20     0.800      228   2         5     0.801      234  
end example
 

The required sample size per group to achieve a power of 0.8 is 228 if the median loss time is 20 years for the proposed treatment. Only six more patients are required in each group if the median loss time is as short as five years.

Example 57.7. Confidence Interval Precision

An investment firm has hired you to help plan a study to estimate the success of a new investment strategy called IntuiVest. The study involves complex simulations of market conditions over time, and it tracks the balance of a hypothetical brokerage account starting with $50,000. Each simulation is very expensive in terms of computing time. You are asked to determine an appropriate number of simulations to estimate the average change in the account balance at the end of three years. The goal is to have a 95% chance of obtaining a 90% confidence interval whose half-width is at most $1,000. That is, the firm wants to have a 95% chance of being able to correctly claim at the end of the study that Our research shows with 90% confidence that IntuiVest yields a profit of $X +/ ˆ’ $1,000 at the end of three years on an initial investment of $50,000 (under simulated market conditions).

The probability of achieving the desired precision (that is, a small interval width) can be calculated either unconditionally or conditionally given that the true mean is captured by the interval. You decide to use the conditional form, considering two of its advantages:

  • The conditional probability is usually lower than the unconditional probability for the same sample size, meaning that the conditional form is generally conservative.

  • The overall probability of achieving the desired precision and capturing the true mean is easily computed as the product of the half-width probability and the confidence level. In this case, the overall probability is 0 . 95 — 0 . 9 = 0 . 855.

Based on some initial simulations, you expect a standard deviation between $25,000 and $45,000 for the ending account balance. You will consider both of these values in the sample size analysis.

As mentioned in the Overview of Power Concepts section on page 3488, an analysis of confidence interval precision is analogous to a traditional power analysis, with CI Half-Width taking the place of effect size and Prob(Width) taking the place of power. In this example, the target CI Half-Width is 1000, and the desired Prob(Width) is 0.95.

In addition to computing sample sizes for a half-width of $1,000, you are asked to plot the required number of simulations for a range of half-widths between $500 and $2,000. Use the ONESAMPLEMEANS statement with the CI=T option to implement the sample size determination. The following statements perform the analysis:

  proc power;   onesamplemeans ci=t   alpha = 0.1   halfwidth = 1000   stddev = 25000 45000   probwidth = 0.95   ntotal = .;   plot x=effect min=500 max=2000;   run;  

The NTOTAL=. option identifies sample size as the parameter to compute. The ALPHA=0.1 option specifies a confidence level of 1 ˆ’ ± = 0.9. The HALFWIDTH= option specifies the target half-width, and the STDDEV= option specifies the conjectured standard deviation values. The PROBWIDTH= option specifies the desired probability of achieving the target precision. The default value PROBTYPE=CONDITIONAL specifies that this probability is conditional on the true mean being captured by the interval. The default of SIDES=2 indicates a 2-sided interval.

Output 57.7.1 shows the output, and Output 57.7.2 shows the plot.

Output 57.7.1: Sample Size Determination for Confidence Interval Precision
start example
  The POWER Procedure   Confidence Interval for Mean   Fixed Scenario Elements   Distribution                 Normal   Method                        Exact   Alpha                           0.1   CI Half-Width                  1000   Nominal Prob(Width)            0.95   Number of Sides                   2   Prob Type               Conditional   Computed N Total   Actual   Std       Prob        N   Index       Dev    (Width)    Total   1     25000      0.951     1788   2     45000      0.950     5652  
end example
 
Output 57.7.2: Plot of Sample Size vs. Confidence Interval Half-Width
start example
click to expand
end example
 

The number of simulations required in order to have a 95% chance of obtaining a half-width of at most 1000 is between 1788 and 5652, depending on the standard deviation. The plot reveals that over 20,000 simulations would be required for a half-width of 500 assuming the higher standard deviation.

Example 57.8. Customizing Plots

The example in this section demonstrates various ways you can modify and enhance plots:

  • assigning analysis parameters to axes

  • fine-tuning a sample size axis

  • adding reference lines

  • linking plot features to analysis parameters

  • choosing key (legend) styles

  • modifying symbol locations

The example plots are all based on a sample size analysis for a two-sample t test of group mean difference. You start by computing the sample size required to achieve a power of 0.9 using a 2-sided test with ± = 0 . 05, assuming the first mean is 12, the second mean is either 15 or 18, and the standard deviation is either 7 or 9.

Use the TWOSAMPLEMEANS statement with the TEST=DIFF option to compute the required sample sizes. Indicate total sample size as the result parameter by supplying a missing value (.) with the NTOTAL= option. Use the GROUPMEANS=, STDDEV=, and POWER= option to specify values of the other parameters. The following statements perform the sample size computations.

  proc power;   twosamplemeans test=diff   groupmeans   = 12  15 18   stddev       = 7 9   power        = 0.9   ntotal       = .;   run;  

Default values for the NULLDIFF=, SIDES=, GROUPWEIGHTS=, and DIST= options specify a null mean difference of 0, 2-sided test, balanced design, and assumption of normally distributed data.

Output 57.8.1 shows that the required sample size ranges from 60 to 382 depending on the unknown standard deviation and second mean.

Output 57.8.1: Computed Sample Sizes
start example
  The POWER Procedure   Two-sample t Test for Mean Difference   Fixed Scenario Elements   Distribution             Normal   Method                    Exact   Group 1 Mean                 12   Nominal Power               0.9   Number of Sides               2   Null Difference               0   Alpha                      0.05   Group 1 Weight                1   Group 2 Weight                1   Computed N Total   Std    Actual        N   Index    Mean2    Dev     Power    Total   1       15      7     0.902      232   2       15      9     0.901      382   3       18      7     0.904       60   4       18      9     0.904       98  
end example
 

Assigning Analysis Parameters to Axes

Use the PLOT statement to produce plots for all power and sample size analyses in PROC POWER. For the sample size analysis described at the beginning of this example, suppose you want to plot the required sample size on the y-axis against a range of powers between 0.5 and 0.95 on the x-axis. The X= and Y= options specify which parameter to plot against the result, and which axis to assign to this parameter. You can use either the X= or Y= option, but not both. Use the X=POWER option in PLOT statement to request a plot with power on the x-axis. The result parameter, here total sample size, is always plotted on the other axis. Use the MIN= and MAX= options to specify the range of the axis indicated with either the X= or the Y= option. Here, specify MIN=0.5 and MAX=0.95 to specify the power range. The following statements produce the plot.

  proc power plotonly;   twosamplemeans test=diff   groupmeans   = 12  15 18   stddev       = 7 9   power        = 0.9   ntotal       = .;   plot x=power min=0.5 max=0.95;   run;  

Note that the value (0.9) of the POWER= option in the TWOSAMPLEMEANS statement is only a placeholder when the PLOTONLY option is used and both the MIN= and MAX= options are used, because the values of the MIN= and MAX= options override the value of 0.9. But the POWER= option itself is still required in the TWOSAMPLEMEANS statement, to provide a complete specification of the sample size analysis.

The resulting plot is shown in Output 57.8.2.

Output 57.8.2: Plot of Sample Size versus Power
start example
click to expand
end example
 

The line style identifies the group means scenario, and the plotting symbol identifies the standard deviation scenario. The locations of plotting symbols indicate computed sample sizes; the curves are linear interpolations of these points. By default, each curve consists of approximately 20 computed points (sometimes slightly more or less, depending on the analysis).

If you would rather plot power on the y-axis versus sample size on the x-axis, you have two general strategies to choose from. One strategy is to use the Y= option instead of the X= option in the PLOT statement:

  plot y=power min=0.5 max=0.95;  

Note that the resulting plot ( Output 57.8.3) is essentially a mirror image of Output 57.8.2. The axis ranges are set such that each curve in Output 57.8.3 contains similar values of Y instead of X. Each plotted point represents the computed value of the x-axis at the input value of the y-axis.

Output 57.8.3: Plot of Power versus Sample Size using First Strategy
start example
click to expand
end example
 

A second strategy for plotting power versus sample size (when originally solving for sample size) is to invert the analysis and base the plot on computed power for a given range of sample sizes. This strategy works well for monotonic power curves (as is the case for the t test and most other continuous analyses). It is advantageous in the sense of preserving the traditional role of the y-axis as the computed parameter. A common way to implement this strategy is

  • Determine the range of sample sizes sufficient to cover at the desired power range for all curves (where each curve represents a scenario for standard deviation and second group mean).

  • Use this range for the x-axis of a plot.

To determine the required sample sizes for target powers of 0.5 and 0.95, change the values in the POWER= option to reflect this range:

  proc power;   twosamplemeans test=diff   groupmeans   = 12  15 18   stddev       = 7 9   power        = 0.5 0.95   ntotal       = .;   run;  

Output 57.8.4 reveals that a sample size range of 24 to 470 is approximately sufficient to cover the desired power range of 0.5 to 0.95 for all curves (approximately because the actual power at the rounded sample size of 24 is slightly higher than the nominal power of 0.5).

Output 57.8.4: Computed Sample Sizes
start example
  The POWER Procedure   Two-sample t Test for Mean Difference   Fixed Scenario Elements   Distribution             Normal   Method                    Exact   Group 1 Mean                 12   Number of Sides               2   Null Difference               0   Alpha                      0.05   Group 1 Weight                1   Group 2 Weight                1   Computed N Total   Std    Nominal    Actual        N   Index    Mean2    Dev      Power     Power    Total   1       15      7       0.50     0.502       86   2       15      7       0.95     0.951      286   3       15      9       0.50     0.505      142   4       15      9       0.95     0.950      470   5       18      7       0.50     0.519       24   6       18      7       0.95     0.953       74   7       18      9       0.50     0.516       38   8       18      9       0.95     0.952      120  
end example
 

To plot power on the y-axis for sample sizes between 20 and 500, use the X=N option in the PLOT statement with MIN=20 and MAX=500:

  proc power plotonly;   twosamplemeans test=diff   groupmeans   = 12  15 18   stddev       = 7 9   power        = .   ntotal       = 200;   plot x=n min=20 max=500;   run;  

Each curve in the resulting plot in Output 57.8.5 covers at least a power range of 0.5 to 0.95.

Output 57.8.5: Plot of Power versus Sample Size Using Second Strategy
start example
click to expand
end example
 

Finally, suppose you want to produce a plot of sample size versus effect size for a power of 0.9. In this case, the effect size is defined to be the mean difference. You need to reparameterize the analysis by using the MEANDIFF= option instead of the GROUPMEANS= option to produce a plot, since each plot axis must be represented by a scalar parameter. Use the X=EFFECT option in the PLOT statement to assign the mean difference to the x-axis. The following statements produce a plot of required sample size to detect mean differences between 3 and 6.

  proc power plotonly;   twosamplemeans test=diff   meandiff     = 3 6   stddev       = 7 9   power        = 0.9   ntotal       = .;   plot x=effect min=3 max=6;   run;  

The resulting plot Output 57.8.6 shows how the required sample size decreases with increasing mean difference.

Output 57.8.6: Plot of Sample Size versus Mean Difference
start example
click to expand
end example
 

Fine-Tuning a Sample Size Axis

Consider the following plot request for a sample size analysis similar to the one in Output 57.8.1 but with only a single scenario, and with unbalanced sample size allocation of 2:1.

  proc power plotonly;   ods output plotcontent=PlotData;   twosamplemeans test=diff   groupmeans   = 12  18   stddev       = 7   groupweights = 2  1   power        = .   ntotal       = 20;   plot x=n min=20 max=50 npoints=20;   run;  

The MIN=, MAX=, and NPOINTS= options in the PLOT statement request a plot with 20 points between 20 and 50. But the resulting plot ( Output 57.8.7) appears to have only 11 points, and they range from 18 to 48.

Output 57.8.7: Plot with Overlapping Points
start example
click to expand
end example
 

The reason that this plot has fewer points than usual is due to the rounding of sample sizes. If you do not use the NFRACTIONAL option in the analysis statement (here, the TWOSAMPLEMEANS statement), then the set of sample size points determined by the MIN=, MAX=, NPOINTS=, and STEP= options in the PLOT statement may be rounded to satisfy the allocation weights. In this case, they are rounded down to the nearest multiples of 3 (the sum of the weights), and many of the points overlap. To see the overlap, you can print the NominalNTotal (unadjusted) and NTotal (rounded) variables in the PlotContent ODS object (here saved to a data set called PlotData ):

  proc print data=PlotData;   var NominalNTotal NTotal;   run;  

The output is shown in Output 57.8.8.

Output 57.8.8: Sample Sizes
start example
  Nominal   Obs   NTotal     NTotal   1     18.0       18   2     19.6       18   3     21.2       21   4     22.7       21   5     24.3       24   6     25.9       24   7     27.5       27   8     29.1       27   9     30.6       30   10     32.2       30   11     33.8       33   12     35.4       33   13     36.9       36   14     38.5       36   15     40.1       39   16     41.7       39   17     43.3       42   18     44.8       42   19     46.4       45   20     48.0       48  
end example
 

Besides overlapping of sample size points, another peculiarity that might occur without the NFRACTIONAL option is unequal spacing; for example, in the plot in Output 57.8.9, created with the following statements.

  proc power plotonly;   twosamplemeans test=diff   groupmeans   = 12  18   stddev       = 7   groupweights = 2  1   power        = .   ntotal       = 20;   plot x=n min=20 max=50 npoints=5;   run;  
Output 57.8.9: Plot with Unequally Spaced Points
start example
click to expand
end example
 

If you want to guarantee evenly spaced, nonoverlapping sample size points in your plots, you can either (1) use the NFRACTIONAL option in the analysis statement preceding the PLOT statement, or (2) use the STEP= option and provide values for the MIN=, MAX=, and STEP= options in the PLOT statement that are multiples of the sum of the allocation weights. Note that this sum is simply 1 for one-sample and paired designs and 2 for balanced two-sample designs. So, any integer step value works well for one-sample and paired designs, and any even step value works well for balanced two-sample designs. Both of these strategies will avoid rounding adjustments.

The following statements implement the first strategy to create the plot in Output 57.8.10, using the NFRACTIONAL option in the TWOSAMPLEMEANS statement.

  proc power plotonly;   twosamplemeans test=diff   nfractional   groupmeans   = 12  18   stddev       = 7   groupweights = 2  1   power        = .   ntotal       = 20;   plot x=n min=20 max=50 npoints=20;   run;  
Output 57.8.10: Plot with Fractional Sample Sizes
start example
click to expand
end example
 

To implement the second strategy, use multiples of 3 for the STEP=, MIN=, and MAX= options in the PLOT statement (because the sum of the allocation weights is 2 + 1 = 3). The following statements use STEP=3, MIN=18, and MAX=48 to create a plot that looks identical to Output 57.8.7 but suffers no overlapping of points.

  proc power plotonly;   twosamplemeans test=diff   groupmeans   = 12  18   stddev       = 7   groupweights = 2  1   power        = .   ntotal       = 20;   plot x=n min=18 max=48 step=3;   run;  

Adding Reference Lines

Suppose you want to add reference lines to highlight power=0.8 and power=0.9 on the plot in Output 57.8.5. You can add simple reference lines using the YOPTS= option and REF= sub-option in the PLOT statement to produce Output 57.8.11, using the following statements.

  proc power plotonly;   twosamplemeans test=diff   groupmeans   = 12  15 18   stddev       = 7 9   power        = .   ntotal       = 100;   plot x=n min=20 max=500   yopts=(ref=0.8 0.9);   run;  
Output 57.8.11: Plot with Simple Reference Lines on Y-Axis
start example
click to expand
end example
 

Or, you can specify CROSSREF =YES to add reference lines that intersect each curve and cross over to the other axis:

  plot x=n min=20 max=500   yopts=(ref=0.8 0.9 crossref=yes);  

The resulting plot is shown in Output 57.8.12.

Output 57.8.12: Plot with CROSSREF=YES Style Reference Lines from Y-Axis
start example
click to expand
end example
 

You can also add reference lines for the x-axis by using the XOPTS= option instead of the YOPTS= option. For example, the following plot statement produces Output 57.8.13, which has crossing reference lines highlighting the sample size of 100.

  plot x=n min=20 max=500   xopts=(ref=100 crossref=yes);  
Output 57.8.13: Plot with CROSSREF=YES Style Reference Lines from X-Axis
start example
click to expand
end example
 

Linking Plot Features to Analysis Parameters

You can use the VARY option in the PLOT statement to specify which of the following features you wish to associate with analysis parameters.

  • line style

  • plotting symbol

  • color

  • panel

You can specify mappings between each of these features and one or more analysis parameters, or you can simply choose a subset of these features to use (and rely on default settings to associate these features with multiple-valued analysis parameters).

Suppose you supplement the sample size analysis in Output 57.8.5 to include three values of alpha, using the following statements.

  proc power plotonly;   twosamplemeans test=diff   groupmeans   = 12  15 18   stddev       = 7 9   alpha        = 0.01 0.025 0.1   power        = .   ntotal       = 100;   plot x=n min=20 max=500;   run;  

The defaults for the VARY option in the PLOT statement specify line style varying by the ALPHA= parameter, plotting symbol varying by the GROUPMEANS= parameter, panel varying by the STDDEV= parameter, and color remaining constant. The resulting plot, consisting of two panels, is shown in Output 57.8.14 and Output 57.8.15.

Output 57.8.14: Plot with Default VARY Settings ”Panel 1 of 2
start example
click to expand
end example
 
Output 57.8.15: Plot with Default VARY Settings ”Panel 2 of 2
start example
click to expand
end example
 

Suppose you want to produce a plot with only one panel that varies color in addition to line style and plotting symbol. Include the LINESTYLE, SYMBOL, and COLOR keywords in the VARY option in the PLOT statement, as follows, to produce the plot in Output 57.8.16.

  plot x=n min=20 max=500   vary (linestyle, symbol, color);  
Output 57.8.16: Plot with Varying Color Instead of Panel
start example
click to expand
end example
 

Finally, suppose you want to specify which features are used and which analysis parameters they are linked to. The following PLOT statement produces a two-panel plot (shown in Output 57.8.17 and Output 57.8.18) in which line style varies by standard deviation, plotting symbol varies by both alpha and sides, and panel varies by means.

  plot x=n min=20 max=500   vary (linestyle by stddev,   symbol by alpha sides,   panel by groupmeans);  
Output 57.8.17: Plot with Features Explicitly Linked to Parameters ”Panel 1 of 2
start example
click to expand
end example
 
Output 57.8.18: Plot with Features Explicitly Linked to Parameters ”Panel 2 of 2
start example
click to expand
end example
 

Choosing Key (Legend) Styles

The default style for the key (or legend) is one that displays the association between levels of features and levels of analysis parameters, located below the x-axis. For example, Output 57.8.5 demonstrates this style of key.

You can reproduce Output 57.8.5 with the same key but a different location, inside the plotting region, using the POS=INSET option within the KEY=BYFEATURE option in the PLOT statement. The following statements product the plot in Output 57.8.19.

  proc power plotonly;   twosamplemeans test=diff   groupmeans   = 12  15 18   stddev       = 7 9   power        = .   ntotal       = 200;   plot x=n min=20 max=500   key = byfeature(pos=inset);   run;  
Output 57.8.19: Plot with a By-Feature Key Inside the Plotting Region
start example
click to expand
end example
 

Alternatively, you can specify a key that identifies each individual curve separately by number using the KEY=BYCURVE option in the PLOT statement:

  plot x=n min=20 max=500   key = bycurve;  

The resulting plot is shown in Output 57.8.20.

Output 57.8.20: Plot with a Numbered By-Curve Key
start example
click to expand
end example
 

Use the NUMBERS=OFF option within the KEY=BYCURVE option to specify a nonnumbered key that identifies curves with samples of line styles, symbols, and colors:

  plot x=n min=20 max=500   key = bycurve(numbers=off pos=inset);  

The POS=INSET suboption places the key within the plotting region. The resulting plot is shown in Output 57.8.21.

Output 57.8.21: Plot with a Nonnumbered By-Curve Key
start example
click to expand
end example
 

Finally, you can attach labels directly to curves with the KEY=ONCURVES option. The following plot statement produces Output 57.8.22.

  plot x=n min=20 max=500   key = oncurves;  
Output 57.8.22: Plot with Directly Labeled Curves
start example
click to expand
end example
 

Modifying Symbol Locations

The default locations for plotting symbols are the points computed directly from the power and sample size algorithms. For example, Output 57.8.5 shows plotting symbols corresponding to computed points. The curves connecting these points are interpolated (as indicated by the INTERPOL= option in the PLOT statement).

You can modify the locations of plotting symbols using the MARKERS= option in the plot statement. The MARKERS=ANALYSIS option places plotting symbols at locations corresponding to the input specified in the analysis statement preceding the PLOT statement. You may prefer this as an alternative to using reference lines to highlight specific points. For example, you can reproduce Output 57.8.5, but with the plotting symbols located at the sample sizes shown in Output 57.8.1, using the following statements.

  proc power plotonly;   twosamplemeans test=diff   groupmeans   = 12  15 18   stddev       = 7 9   power        = .   ntotal       = 232 382 60 98;   plot x=n min=20 max=500   markers=analysis;   run;  

The analysis statement here is the TWOSAMPLEMEANS statement. The MARKERS=ANALYSIS option in the PLOT statement causes the plotting symbols to occur at sample sizes specified by the NTOTAL= option in the TWOSAMPLEMEANS statement: 232, 382, 60, and 98. The resulting plot is shown in Output 57.8.23.

Output 57.8.23: Plot with MARKERS=ANALYSIS
start example
click to expand
end example
 

You can also use the MARKERS=NICE option to align symbols with the tick marks on one of the axes (the x-axis when the X= option is used, or the y-axis when the Y= is used):

  plot x=n min=20 max=500   markers=nice;  

The plot created by this PLOT statement is shown in Output 57.8.24.

Output 57.8.24: Plot with MARKERS=NICE
start example
click to expand
end example
 

Note that the plotting symbols are aligned with the tick marks on the x-axis because the X= option is specified.




SAS.STAT 9.1 Users Guide (Vol. 5)
SAS.STAT 9.1 Users Guide (Vol. 5)
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 98

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