## Wednesday, July 10, 2013

### Power Calculation

Example of finding power of a balanced one way ANOVA:
proc power;
onewayanova test = overall
groupmeans = 59 | 66 | 42
std = 5 8 10 12
npergroup = 3 4 5 6 7 8 9 10
power = . ;
plot ;
run;

Contrast power:
proc power;
onewayanova test = contrast
contrast = (1 -1 0 0 0 0) (0 1 0 0 -1 0) (0 0 1 -1 0 0)
groupmeans = (5 4 6 11 12 9)
std = 4
npergroup = 5
power = .
;
run;

Example of finding n of an unbalanced one way ANOVA:
proc power;
onewayanova test = overall
groupmeans = 3 | 7 | 8
stddev = 4
groupweights = (1 2 2)
ntotal = .
power = 0.8
;
run;

Example of finding power of a chi-squared test:
proc power;
twosamplefreq test = pchi
groupproportions = (.6 .4) (.7 .3) (.55 .45) (.49 .51)
nullproportiondiff = 0
npergroup =25 50 75 100 200
power = . ;
plot;
run;

Example of finding power for a survival analysis:
proc power;
twosamplesurvival test = logrank
gexphs = 0.3567 | 0.5978 0.6931
grouplossexphazards = (0.3567 0.3567)
accrualtime = 1
followuptime = 1
groupweights = (1 2)
power = .
ntotal = 225 ;
run;