The POWER Procedure

Example 95.2 The Sawtooth Power Function in Proportion Analyses

(View the complete code for this example.)

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 I error rate) for discrete tests strays below the target level and varies with sample size. The power loss from a decrease in the Type I error rate can outweigh the power gain from an increase in sample size. The example discussed here demonstrates this "sawtooth" phenomenon. For additional discussion on the topic, see 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 one-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 alpha = 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 by 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 one-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, respectively. The PROPORTION= option specifies your conjecture of 0.3 for the true proportion.

Output 95.2.1: Approximate Sample Size for z Test of a Proportion

The POWER Procedure
Z Test for Binomial Proportion

Fixed Scenario Elements
MethodNormal approximation
Number of Sides1
Null Proportion0.3
Alpha0.05
Binomial Proportion0.2
Nominal Power0.8
Variance EstimateNull Variance

Computed N Total
Actual PowerN Total
0.800119


The results, shown in Output 95.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%, by using the z test. A similar analysis (Output 95.2.2) reveals an approximate sample size of N = 129 for the z test with continuity correction, which is performed by using TEST=ADJZ:

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

Output 95.2.2: Approximate Sample Size for z Test with Continuity Correction

The POWER Procedure
Z Test for Binomial Proportion with Continuity Adjustment

Fixed Scenario Elements
MethodNormal approximation
Number of Sides1
Null Proportion0.3
Alpha0.05
Binomial Proportion0.2
Nominal Power0.8
Variance EstimateNull Variance

Computed N Total
Actual PowerN Total
0.801129


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:

ods graphics on;

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 95.2.3 shows the resulting plot.

Output 95.2.3: Plot of Power versus Sample Size for Exact Binomial Test

Plot of Power versus Sample Size for Exact Binomial Test


Note the sawtooth pattern in Output 95.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 might 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 95.2.4 shows the resulting plot.

Output 95.2.4: Plot for Assessing Sensitivity to True Proportion Value

Plot for Assessing Sensitivity to True Proportion Value


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.18, and as low as 0.62 if the proportion is 0.22. 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 that corresponds to Output 95.2.3 to a data set:

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 include 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 95.2.5 shows the plot data.

Output 95.2.5: Numerical Content of Plot

ObsNTotalLowerCritValAlphaPower
1110240.03560.729
2111240.03130.713
3112250.04460.771
4113250.03950.756
5114250.03490.741
6115260.04900.795
7116260.04350.781
8117260.03860.767
9118260.03410.752
10119270.04780.804
11120270.04250.790
12121270.03770.776
13122270.03340.762
14123280.04650.812
15124280.04140.799
16125280.03680.786
17126280.03270.772
18127290.04530.820
19128290.04040.807
20129290.03590.794
21130300.04930.838
22131300.04410.827
23132300.03940.815
24133300.03510.803
25134310.04800.845
26135310.04290.834
27136310.03840.823
28137310.03420.811
29138320.04660.851
30139320.04180.841
31140320.03740.830


Note that whenever the critical value changes, the actual alpha jumps up to a value close to the nominal alpha = 0.05, and the power also jumps up. Then while the critical value stays constant, the actual alpha 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 95.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 95.2.6.

Output 95.2.6: Plot of Power versus Sample Size for Another One-sided Test

Plot of Power versus Sample Size for Another One-sided Test


Finally, two-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 two-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;

ods graphics off;

Output 95.2.7 shows the resulting plot.

Output 95.2.7: Plot of Power versus Sample Size for a Two-Sided Test

Plot of Power versus Sample Size for a Two-Sided Test


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?

Last updated: October 28, 2020