fpower Power computations for ANOVA designs fpower

SAS Macro Programs: fpower

$Version: 1.2 (24 Mar 1995)
Michael Friendly
York University



The fpower macro ( [download] get fpower.sas)

Power computations for ANOVA designs

The fpower macro computes power of an F-test for main effects for one effect in a one- or n-way design with or without repeated measures, assuming main effects are fixed. The alternative used is a minimum power alternative. Actually, the program can be used for ANY fixed effect in ANY crossed factorial design, by designating the levels of the effect of interest as A, and the levels of all other crossed factors as B.

If the design has repeated measures, the intraclass correlation (RHO) is assumed to be positive and constant across all repeated measures.

The macro can calculate power for a range of sample sizes (N) and a range of effect sizes (DELTA)

Ordinarily, the program produces printed output in the form of a Power Table, listing the power value for a combination of sample size and effect size. In addition, the program can rearrange this information into a Sample Size Table, showing the sample size required for given effect size and power values. An output dataset is also created for plotting or saving, and it contains an observation for each entry.

Effect Size

Effect size (delta) is specified by the difference between the largest mean and the smallest mean, in units of the within-cell standard deviation ( sigma = the square root of the MSE):
            largest mean - smallest mean
delta   =   ----------------------------
                      sigma
The minimum power specification corresponds to the alternative hypothesis that all means other than the two extreme one are equal to the grand mean, and the two extreme factor level means are
        
          T1 = GM - DELTA/2                                 
          Tk = GM + DELTA/2
where DELTA is specified in units of SIGMA = SQRT(MSE) The computations assume: (a) fixed effects, and (b) equal sample sizes in all treatments. Under these assumptions, the non-centrality parameter of the F-distribution can be calculated as N (delta^2)/2, where N is the sample size per treatment.

Effect size delta values are typically in the range of 0 - 3. In social science applications, values of delta = 0.25, 0.75, and 1.25 or greater correspond to "small", "medium", and "large" effects, according to Cohen & Cohen, Statistical Power Analysis for the Behavioral Sciences.

Method

Usage

fpower is a macro program. Only the A= parameter (number of levels of the effect of interest) need be specified.

The arguments may be listed within parentheses in any order, separated by commas. For example:

   %fpower(A=4,  ..., )

Parameters

A=
Number of levels of the effect for which power is to be calculated. Ordinarily, this will be the number of levels of a main effect. However, to calculate the power for an interaction of two factors in a 2 x 3 design, set A=2*3=6.
B=1
Number of levels of a factor factor B crossed with A (default=1)
C=1
Levels of crossed factor C (default=1) For >3 factors, make C=product of # of levels of factors D, E, etc.
R=1
Number of levels of a repeated measure factor crossed with effect A.
ALPHA=.05
Significance level of test of effect A
N =%str( 2 to 10 by 1, 12 to 18 by 2, 20 to 40 by 5, 50),
List of sample sizes for which power is to be calculated. A separate computation is performed for each value specified. You may specify a single value, a list of values separated by commas, a range of the form x TO y BY z, or a combination of these. However, you must surround the N= value with %STR() if any commas appear in it. For example,
n=10 to 30 by 5
n=%str(2, 5, 6, 8)
n=%str( 2 to 10 by 1, 12 to 18 by 2,  20 to 40 by 5, 50)
DELTA=.50 to 2.5 by 0.25
List of DELTA values for which power is to be calculated. A separate computation is performed for each value specified. You may specify a single value, a list of values separated by commas, a range of the form x TO y BY z, or a combination of these. However, you must surround the DELTA= value with %STR() if any commas appear in it.
RHO=0
Intraclass correlation for repeated measures (a list of values, like N= and DELTA=)
PTABLE=YES
Print a power table?
PLOT=NO
Plot power*delta=N ?
NTABLE=NO
Print a sample-size table ?
OUT=PWRTABLE
The name of the output dataset.

Example

To determine power or sample size for 5 groups in a one-way design, using the default DELTA and N= options:
%include macros(fpower);        *-- or include in an autocall library;
%fpower(a=5);
To determine the power or sample size for the BxC interaction in a 4x3x2 design, specify a=6 (the combinations of factors B and C), and b=4 (levels of factor A for each BC combination. The delta values here refer to the BC treatment means.
%fpower(a=6,b=4);

See also

WWW form interface for the fpower macro
meanplot
mpower Retrospective power analysis for multivariate GLMs
rpower Retrospective power analysis for univariate GLMs