FAQ/power/owAnovaN - CBU statistics Wiki

You are not allowed to do login on this page. Login and try again.

Clear message
location: FAQ / power / owAnovaN

This program uses R-squared, the multiple correlation, as the effect size which may also be expressed as Cohen's $$f^text{2}$$= R-sq/(1-R-sq). R-squared may be used as an effect size in regressions including one-way anovas as a special case.

From Cohen(1988) it follows R-squareds of 0.02, 0.13 and 0.26 are suggested conventions for small, medium and large effect size for regressions involving continuous predictors. R-squareds of 0.01, 0.06 and 0.14 are the small, medium and large effect sizes for a one-way anova.

Alpha is the type I error, df of the effect, dfe, is the total degrees of freedom for the predictors of interest, df of the confounders, dfc, is the total number of degrees of freedom of the other predictors in the multiple regression, rsq is the multiple correlation with given power. The program then outputs the total sample size required. This can also be done using a spreadsheet or on-line calculator or in R.

df for each predictor equals k -1 for a group predictor with k levels or 1 for each continuous predictor.

Miles and Shevlin (2001) also produce some power curves corresponding to the small, medium and large effects above which can also be used to find sample sizes for different powers (and vice-versa).

[ADJUST THE EXAMPLE INPUT AS DESIRED; THEN COPY AND PASTE INTO A SPSS SYNTAX WINDOW AND RUN; OUTPUT BOTH TO SPREADSHEET AND OUTPUT WINDOW].

DATA LIST free
/alpha dfe dfc rsq power. 
BEGIN DATA. 
.05 2 1 0.3 0.90
END DATA. 

set errors=none.
define owanov ( !pos !tokens(1)
                   /!pos !tokens(1)
                   /!pos !tokens(1)
                   /!pos !tokens(1)
                   /!pos !tokens(1)).

COMPUTE #POW = !5.

compute #conf = (1-!1).
compute #lc3 = 1.
compute #ind=0.
compute ntot = 15.000.
comment COMPUTE #LC1 = 2.000.
COMPUTE #CUMF2 = 1 - NCDF.F(IDF.F(#conf,!2,ntot-!2-!3-1),!2,NTOT-!2-!3-1,NTOT*!4/(1-!4)).
COMPUTE #DIFF = 1 .
SET MXLOOPS=10000.
LOOP IF (#DIFF GT .00005) .
+       DO IF (#CUMF2 LT #pow) .
+               COMPUTE #LC3 = NTOT .
+               COMPUTE NTOT = (NTOT + rnd(ntot/3)).
+               COMPUTE #CUMF2 =  1 - NCDF.F(IDF.F(#conf,!2,ntot-!2-!3-1),!2,NTOT-!2-!3-1,NTOT*!4/(1-!4)).

+       ELSE .
+               COMPUTE #LC1 = ntot .
+               COMPUTE ntot = (ntot + #LC3)/2 .
+               COMPUTE #CUMF2 = 1 - NCDF.F(IDF.F(#conf,!2,ntot-!2-!3-1),!2,NTOT-!2-!3-1,NTOT*!4/(1-!4)).

+       END IF .
+       COMPUTE #DIFF = ABS(#CUMF2 - #pow) .
END LOOP .
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 dfe=!2.
compute dfc=!3.
compute rsq=!4.
compute power=#pow.
formats ntot (f7.0) alpha (f5.2) dfe (f5.2) dfc (f5.2) rsq (f5.2) power (f5.2).
variable labels ntot 'Total Sample Size Required' /alpha 'Alpha' /dfe 'Df effect' /dfc 'Df confounders' /rsq 'R-Squared' /power 'Power'.
report format=list automatic align(center)
  /variables=ntot alpha dfe dfc rsq power 
  /title "Multiple regression sample size for given power" .
!enddefine.
matrix.
get m /variables=alpha g rsq power  /missing=omit.
compute alpha=make(1,1,0).
compute dfe=make(1,1,0).
compute dfc=make(1,1,0).
compute rsq=make(1,1,0).
compute power=make(1,1,0).
compute alpha=m(:,1).
compute dfe=m(:,2).
compute dfc=m(:,3).
compute rsq=m(:,4).
compute power=m(:,5).  
end matrix.
owanov alpha dfe dfc rsq power.

Reference

Miles J and Shevlin M (2001) Applying regression and correlation. A guide for students and researchers. Sage:London.