SUPPORT / SAMPLES & SAS NOTES
 

Support

Sample 25011: Prospective or retrospective power computations for GLM analyses

DetailsResultsDownloadsAboutRate It

Prospective or retrospective power computations for GLM analyses

Contents: Purpose / Requirements / Usage / Details / Limitations


NOTE: Beginning in SAS 9.1, use PROC GLMPOWER in SAS/STAT Software to perform prospective power analyses.

PURPOSE:
Calculates the following power-related measures for retrospective and prospective analyses (see the DETAILS section below for definitions):
 
  • Effect size
  • Power for an effect test
  • Adjusted power and confidence limits
  • Least significant number
  • Power of least significant number
 
REQUIREMENTS:
Only Version 6 or later of Base SAS software is required to run the %POWER macro. However, SAS/STAT software (Version 6 or later) is required to fit the desired GLM model.
 
USAGE:
Follow the instructions in the Downloads tab of this sample to save the %POWER macro definition. Replace the text within quotes in the following statement with the location of the %POWER macro definition file on your system. In your SAS program or in the SAS editor window, specify this statement to define the %POWER macro and make it available for use:
   %inc "<location of your file containing the POWER macro>";

Following this statement, you may call the %POWER macro. See the Results tab for an example.

Before using the %POWER macro, you must first run PROC GLM to fit the desired model and use the OUTSTAT= option to create the input data set for the %POWER macro.

These parameters are required:

DATA=
Name of the data set created by the OUTSTAT= option in the previous run of PROC GLM.
 
OUT=
Name of a new data set into which %POWER will store all calculations. In the output data set, values of .N indicate statistics that were not calculated and values of .U indicate that the macro was unable to calculate the statistic.
 
EFFECT=
Single effect from the MODEL statement in the previous run of PROC GLM. Power calculations are performed for the specified effect.
 
CALCS=POWER | ADJPOW | POWCI | LSN
Specifies one of the following statistic to be computed:
  • POWER to request that power be computed and displayed
  • ADJPOW to request that adjusted power be computed and displayed
  • POWCI to request that a confidence interval for adjusted power be computed and displayed
  • LSN to request that the least significant number be computed and displayed.

These optional parameters may also be specified:

SS=SS1 | SS2 | SS3 | SS4
Sums of squares to be used in the power calculations. The default is ss3. These sums of squares must have been computed by the previous run of PROC GLM.
 
ALPHA=
List of significance levels separated by spaces. The default value of 0.05.
 
N=
List of sample sizes separated by spaces. The default value is the observed sample size. Any values you specify are used in addition to the default.
 
SIGMA=
List of standard deviations separated by spaces. The default value is the observed standard deviation. Any values you specify are used in addition to the default.
 
DELTA=
List of effect sizes separated by spaces. The default value is the observed effect size. Any values you specify are used in addition to the default.
 
DETAILS:
Following are definitions of terms that are relevant to using the %POWER macro:
 
Prospective power analysis
Used in the planning phase of a designed experiment to determine how large the sample size must be to detect an effect of a given size (such as the minimum difference between treatment effects that is of practical value).
 
Retrospective power analysis
Used after the analysis of an experiment to determine the power of the conducted test.
 
Power
Is the probability that a false null hypothesis will be rejected. Ideally you would design your experiment to be as powerful as possible at detecting hypotheses of interest. Values of power range from 0 to 1, where values near 0 are low power and values near 1 are high power. Power is a function of the sample size (N), the effect size (delta), the root mean square error (sigma), and the significance level (alpha). The power tells you how likely your experiment is to detect a given difference, delta, at a given significance level, alpha. Power has the following characteristics:
  • If the true value of the parameter is the hypothesized value, the power should be alpha. You do not want to reject the null hypothesis when it is true.
  • If the true value of the parameters is not the hypothesized value, you want the power to be as large as possible.
  • Power increases with the sample size.
  • Power increases as variance decreases.
  • Power increases as the true parameter gets farther from the hypothesized value.
 
Adjusted Power
Is for retrospective power analyses. The adjusted power is smaller than the power as it removes the bias associated with the noncentrality parameter. The noncentrality paramater is biased for any value other than zero. Because power is a function of population quantities that are not known, the usual practice is to substitute sample estimates in power calculations. If you regard these sample estimates as random, you can adjust them to have a more proper expectation. You can also construct a confidence interval for this adjusted power, though it is often very wide. The adjusted power and confidence interval can only be computed for your observed effect size, delta.
 
Least Significant Number (LSN)
Is the number of observations needed to reduce the variance of the estimates enough to achieve a significant result with the given values of alpha, sigma, and delta. If you need more data to achieve significance, the LSN helps tell you how many more. The LSN has the following characteristics:
  • If the LSN is less than the actual sample size N, then the effect is significant. This means that you have more data than you need to detect the significance at the given alpha level.
  • If the LSN is greater than the actual sample size N, the effect is not significant. In this case, if you believe that more data will show the same variance and structural results as the current sample, the LSN suggests how much data you would need to achieve significance.
  • If the LSN is equal to N, then the p-value is equal to the significance level, alpha. The test is on the border of significance.
  • Power calculated when N=LSN is always greater than or equal to 0.5.
  • Power when N=LSN represents the power associated with using the sample size recommended by the LSN.
 
Noncentrality parameter, lambda
Lambda = Nδ2/sigma2, where N is the total sample size, δ is the effect size (delta), and sigma2 is the mean square error. Note that the noncentrality parameter is zero when the null hypothesis is true; that is, when the effect size is zero.
 
Effect Size, delta
Is estimated from the data as sqrt[SS(Hypothesis)/N]. The effect size can be thought of as the minimum difference in means that you want to detect divided by the total sample size.
 
LIMITATIONS:
The %POWER macro is appropriate for fixed-effect linear models fit by PROC GLM only. It is not appropriate for GLM models using the RANDOM, TEST, REPEATED, or MANOVA statements.

The %POWER macro can not be given a power value as input and report the required sample size.

No error checking is done. Be careful to correctly specify the macro parameters.




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.