- alpha is likelihood of making a type I error (usually = 0.05)
- etasq is partial $$\eta^text{2}$$/100 so, for example, 5.9% = 0.059
Partial $$\eta^text{2}$$ = $$ \frac{\mbox{SS(effect)}}{\mbox{SS(effect) + SS(its error)}}$$
or, in other words, the proportion of variance in outcome predicted by the effect after adjusting for other terms in the anova. [attachment:etasqrp.pdf Click here for further details on partial $$\eta^text{2}$$] and [attachment:etasq.pdf here.]
If SS are not available you can[:FAQ/power/rsqform: construct eta-squared].
For B between subject factors in term of interest with levels $$b_{i}$$, i=1, ..., B and W with subject factors in term of interest with levels $$w_{j}$$, j=1, ..., W
- num(erator) = df of term of interest= $$ \prod_{\mbox{factors}} $$ (number of levels of factor -1) in term of interest
bsum = sum of dfs involving only between subject factors $$\sum_{i}^{B} (b_{i} - 1) + \prod_{\mbox{combinations}} (b_{i} - 1)$$ if B > 0 in anova
- = 0 otherwise
where combinations means all lower order combinations of at least two between subject factors making up the factor of interest. e.g. For a three way interaction involving three between subject factors, abc, there are three lower order combinations: ab, ac and bc.
wdf = df of within subject effect if in term of interest = $$ \prod_{j}^{W} (w_{j} - 1) $$ if W > 0 in term of interest
- = 1 otherwise
- power is the power of the test
[:FAQ/power/powexample: Example input]
Computation may be performed using an EXCEL [attachment:anovan.xls spreadsheet] or the below SPSS syntax. Power analysis software using Winer (1991, pp 136-138) for balanced anovas may be downloaded from [http://www.soton.ac.uk/~cpd/anovas/datasets/ here.]
[ COPY AND PASTE THE BOXED BELOW SYNTAX BELOW INTO A SPSS SYNTAX WINDOW AND RUN; ADJUST INPUT DATA AS REQUIRED]
DATA LIST free
/alpha etasq num bsum wdf corr power.
BEGIN DATA.
.05 0.059 2 1 2 0.3 0.85
.05 0.059 2 1 2 0.0 0.85
END DATA.
matrix.
get m /variables=alpha etasq num bsum wdf corr power /missing=omit.
compute alpha=make(1,1,0).
compute etasq=make(1,1,0).
compute num=make(1,1,0).
compute bsum=make(1,1,0).
compute wdf=make(1,1,0).
compute corr=make(1,1,0).
compute power=make(1,1,0).
compute alpha=m(:,1).
compute etasq=m(:,2).
compute num=m(:,3).
compute bsum=m(:,4).
compute wdf=m(:,5).
compute corr=m(:,6).
compute power=m(:,7).
end matrix.
define apow (!pos !tokens(1)
/ !pos !tokens(1)
/ !pos !tokens(1)
/ !pos !tokens(1)
/ !pos !tokens(1)
/ !pos !tokens(1)
/ !pos !tokens(1)).
COMPUTE #POW = !7.
compute #conf = (1-!1).
compute #lc3 = 1.
compute #ind=0.
compute ntot = 700.000.
comment COMPUTE #LC1 = 2.000.
compute denom=(ntot-1-!4)*!5.
COMPUTE #CUMF2 = 1 - NCDF.F(IDF.F(#conf,!3,denom),!3,denom,((denom/num)*(!2/(1-!2)))/(1-!6)).
COMPUTE #DIFF=1.
SET MXLOOPS=10000.
LOOP IF (#DIFF GT .00005) .
+ DO IF (#CUMF2 GT #pow) .
+ COMPUTE #LC3 = ntot.
+ COMPUTE ntot = (Ntot - rnd(1)).
+ COMPUTE denom=(ntot-1-!4)*!5.
+ COMPUTE #CUMF2 = 1 - NCDF.F(IDF.F(#conf,!3,denom),!3,denom,((denom/num)*(!2/(1-!2)))/(1-!6)).
+ ELSE .
+ COMPUTE #LC1 = ntot.
+ COMPUTE ntot = (ntot + #LC3)/2.
+ COMPUTE denom=(ntot-1-!4)*!5.
+ COMPUTE #CUMF2 = 1 - NCDF.F(IDF.F(#conf,!3,denom),!3,denom,((denom/num)*(!2/(1-!2)))/(1-!6)).
+ END IF.
+ COMPUTE #DIFF = ABS(#CUMF2 - #pow) .
END LOOP .
compute pow2 = 1 - NCDF.F(IDF.F(#conf,!3,denom),!3,denom,((denom/num)*(!2/(1-!2)))/(1-!6)).
if (ntot-trunc(ntot) gt 0.5) #ind=1.
if (#ind eq 0) ntot=trunc(ntot)+1.
if (#ind eq 1) ntot=rnd(ntot).
EXECUTE .
compute alpha=!1.
compute etasq=!2.
compute num=!3.
compute bsum=!4.
compute wdf=!5.
compute corr=!6.
compute power=!7.
compute denom=(ntot-1-bsum)*wdf.
formats ntot (f7.0) alpha (f5.2) num (f5.2) denom (f5.2) etasq (f5.2) corr (f5.2) power (f5.2).
variable labels ntot 'Total Sample Size Required' /alpha 'Alpha' /num 'Numerator' /denom 'Denominator' /etasq 'Partial Eta-Sq' /corr 'Correlation' /power 'Power'.
report format=list automatic align(center)
/variables=ntot alpha num denom etasq corr power
/title "Anova term sample size for given power (any anova)" .
!enddefine.
matrix.
get m /variables=alpha etasq num bsum wdf corr power /missing=omit.
compute alpha=make(1,1,0).
compute etasq=make(1,1,0).
compute num=make(1,1,0).
compute bsum=make(1,1,0).
compute wdf=make(1,1,0).
compute corr=make(1,1,0).
compute power=make(1,1,0).
compute alpha=m(:,1).
compute etasq=m(:,2).
compute num=m(:,3).
compute bsum=m(:,4).
compute wdf=m(:,5).
compute corr=m(:,6).
compute power=m(:,7).
end matrix.
apow alpha etasq num bsum wdf corr power.Reference
Winer BJ, Brown DR and Michels KM (1991) Statistical principles in experimental design, 3rd edition. McGraw-Hill:New York.
