Diff for "FAQ/power/unpairn" - CBU statistics Wiki
location: Diff for "FAQ/power/unpairn"
Differences between revisions 5 and 6
Revision 5 as of 2006-11-16 15:46:36
Size: 1517
Editor: PeterWatson
Comment:
Revision 6 as of 2006-11-16 15:47:16
Size: 1518
Editor: PeterWatson
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
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 [attachment:unp.xls spreadsheet calculator] 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 [attachment:unp.xls spreadsheet calculator.]

This program uses Cohen's d or Hedge's g, depending on how pooled group standard deviation is computed, as the effect size (see http://en.wikipedia.org/wiki/Effect_size#Cohen.27s_d) 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 [attachment:unp.xls spreadsheet calculator.]

[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" .

None: FAQ/power/unpairn (last edited 2013-03-08 10:18:04 by localhost)