FAQ/power/rmPowN - CBU statistics Wiki

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment
Type the odd characters out in each group: abz2a 125t7 HhHaHh year.s 5433r21 worl3d

Revision 19 as of 2007-01-15 12:28:19

location: FAQ / power / rmPowN
  • alpha is likelihood of making a type I error (usually = 0.05)
  • etasq is partial eta-squared/100 so, for example, 5.9% = 0.059

Partial Eta-squared = 

SS(effect) divided by the sum of the SS(effect) and 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

  • num(erator) is product over factors comprising term of interest of (number of levels of factor -1)
  • d1 is sum over the factors of (number of levels of between subject factor - 1) $ \sum $

  • d2 is the product over the factors of (number of levels os within subject factor - 1)

  • power is the power of the test

[ 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 d1 d2 power. 
BEGIN DATA. 
.05 0.02 2 3 2 0.23
.05 0.12 2 3 2 0.93
END DATA.

matrix.
get m /variables=alpha etasq num d1 d2 power  /missing=omit.
compute alpha=make(1,1,0).
compute etasq=make(1,1,0).
compute num=make(1,1,0).
compute d1=make(1,1,0).
compute d2=make(1,1,0).
compute power=make(1,1,0).
compute alpha=m(:,1).
compute etasq=m(:,2).
compute num=m(:,3).
compute d1=m(:,4).
compute d2=m(:,5).
compute power=m(:,6).
end matrix.


define apow   (!pos !tokens(1)
                   / !pos !tokens(1)
                   / !pos !tokens(1)
                   / !pos !tokens(1)
                   / !pos !tokens(1)
                   / !pos !tokens(1)).

COMPUTE #POW = !6.

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*!2/(1-!2)).
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*!2/(1-!2)).
+       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*!2/(1-!2)).
+          END IF. 
+       COMPUTE #DIFF = ABS(#CUMF2 - #pow) .
END LOOP .
compute pow2 = 1 - NCDF.F(IDF.F(#conf,!3,denom),!3,denom,denom*!2/(1-!2)).
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 d1=!4.
compute d2=!5.
compute power=!6.
compute denom=(ntot-1-d1)*d2.
formats ntot (f7.0) alpha (f5.2) num (f5.2) denom (f5.2) etasq (f5.2) power (f5.2).
variable labels ntot 'Total Sample Size Required' /alpha 'Alpha' /num 'Numerator' /denom 'Denominator' /etasq 'Partial Eta-Sq' /power 'Power'.
report format=list automatic align(center)
  /variables=ntot alpha num denom etasq power 
  /title "Anova term sample size for given power (any anova)" .
!enddefine.
matrix.
get m /variables=alpha etasq num d1 d2 power  /missing=omit.
compute alpha=make(1,1,0).
compute etasq=make(1,1,0).
compute num=make(1,1,0).
compute d1=make(1,1,0).
compute d2=make(1,1,0).
compute power=make(1,1,0).
compute alpha=m(:,1).
compute etasq=m(:,2).
compute num=m(:,3).
compute d1=m(:,4).
compute d2=m(:,5).
compute power=m(:,6).
end matrix.
apow alpha etasq num d1 d2 power.