FAQ/power/unpairn - CBU statistics Wiki

Please enter your password of your account at the remote wiki below.
/!\ You should trust both wikis because the password could be read by the particular administrators.

Clear message
location: FAQ / power / unpairn

This program uses Cohen's d or Hedge's g, depending on how pooled group standard deviation is computed, as the effect size in an equal groups unpaired t-test.

Alpha is the (two-tailed) type I error, mdiff is the difference in group means, sd is the average group standard deviation with sample sizes inputted as n1 and n2. The program then outputs the power. There is also a spreadsheet calculator and R code. You can specify input in terms of Cohen's d.

[COPY AND PASTE THE SYNTAX BELOW INTO A SPSS SYNTAX WINDOW AND RUN; ADJUST DATA INPUT VALUES AS REQUIRED]

DATA LIST free
/alpha (f10.5) mdiff (f10.5) sd (f10.5) n1 (f10.5) n2 (f10.5). 
BEGIN DATA. 
.05 3.0 4.0 39 39
.05 6.0 10.0 60 45
END DATA. 

matrix.
get m /variables=alpha mdiff sd n1 n2  /missing=omit.
compute alpha=make(1,1,0).
compute mdiff=make(1,1,0).
compute sd=make(1,1,0).
compute n1=make(1,1,0).
compute n2=make(1,1,0).
compute alpha=m(:,1).
compute mdiff=m(:,2).
compute sd=m(:,3).
compute n1=m(:,4).  
compute n2=m(:,5).
end matrix.
COMPUTE power = 1 - NCDF.T(IDF.T(1-alpha/2,n1+n2-2),n1+n2-2,((mdiff)/sd)*SQRT((n1*n2)/(n1+n2))).
exe.
formats n1 (f7.0) n2 (f7.0) alpha (f5.2) mdiff (f5.2) sd (f5.2) power (f5.2).
variable labels n1 'Sample Size 1' /n2 'Sample Size 2' /alpha 'Alpha' /mdiff 'Mean Difference' /sd 'SD' /power 'Power'.
report format=list automatic align(center)
  /variables=n1 n2 alpha mdiff sd power 
  /title "Unpaired t-test power for given sample sizes" .