SUPPORT / SAMPLES & SAS NOTES
 

Support

Sample 25012: Power and sample size for test comparing two proportions

DetailsDownloadsAboutRate It

Power and sample size for test comparing two proportions

Contents: Purpose / Requirements / Usage / Details / See Also / References

NOTE: Beginning in SAS 9, you can use PROC POWER in SAS/STAT software to do these power computations.
PURPOSE:
Computes the power of a test comparing two independent proportions using the Pearson chi-square statistic. Typically used prospectively (prior to data collection and analysis), power is given for various total sample sizes allowing you to pick the sample size that achieves the desired power or type II error (beta)
REQUIREMENTS:
Only Version 6 or later of Base SAS Software is required.
USAGE:
Follow the instructions in the Downloads tab of this sample to save the %POWER2x2 macro definition. Replace the text within quotes in the following statement with the location of the %POWER2x2 macro definition file on your system. In your SAS program or in the SAS editor window, specify this statement to define the %POWER2x2 macro and make it available for use:
   %inc "<location of your file containing the POWER2x2 macro>";

Following this statement, you may call the %POWER2x2 macro. See this discussion of power analysis in 2x2 tables for an example.

These parameters are required:

p1=value
Specifies the success probability for group 1 under the alternative hypothesis. The specified value should be between 0 and 1.
p2=value
Specifies the success probability for group 2 under the alternative hypothesis. The specified value should be between 0 and 1.

This parameter can be specified if the default is not desired:

level=value
Specifies the significance level or size of the test. This is the limit you place on the probability of a type 1 error. The specified value should be between 0 and 1. The default value is 0.05 which sets the probability of a type 1 error at 0.05.

Either the pair n1= and n2= or the pair nmin= and nmax= must be specified, but not both.

n1=value
Specifies the sample size of group 1.
n2=value
Specifies the sample size of group 2.
nmin=value
Specifies the minimum total sample size at which power will be computed.
nmax=value
Specifies the maximum total sample size at which power will be computed.
DETAILS:
See this discussion on power analysis for 2x2 tables for more details.

Hypotheses in the test are:

H0: p1 = p2
HA: p1 ≠ p2

where p1 and p2 are the success probabilities in the two populations. The Pearson chi-square statistic tests the null hypothesis (H0) against the alternative hypothesis (HA) and is available in the FREQ procedure when the CHISQ option is specified in the TABLES statement.

The power is the probability of rejecting H0 and is a function of the true difference in proportions. It is useful to explore the power that results assuming several different settings of the true probabilities. The type 2 error rate (denoted β) is the probability of accepting H0 for some nonzero true difference and is equal to 1-power. The power and β are computed for a range of total sample sizes at a particular alternative hypothesis that you specify.

SEE ALSO:
REFERENCES:
Agresti, A. (1990 and 2002), Categorical Data Analysis, New York: John Wiley & Sons, Inc.



These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.