This program uses Cohen's d as the effect size as recommended by Dunlop, W. P., Cortina, J. M., Vaslow, J. B., & Burke, M. J. (1996) for a paired t-test. This is the same as Cohen's d for a unpaired t-test when the correlation between groups, rho, is zero.
Alpha is the (two-tailed) type I error, mdiff is the difference in group means, sd is the average group standard deviation with (common group) sample size, n, and the correlation between groups equal to rho. The program then outputs the power. Computation can also be done using a spreadsheet or in R. You can specify input in terms of Cohen's d.
Reference:
Dunlop, W. P., Cortina, J. M., Vaslow, J. B., & Burke, M. J. (1996). Meta-analysis of experiments with matched groups or repeated measures designs. Psychological Methods, 1, 170-177.
[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) n (f10.5) rho (f10.5). BEGIN DATA. .05 2.0 4.0 40 0.0 .05 2.0 4.0 40 0.3 END DATA. matrix. get m /variables=alpha mdiff sd n rho /missing=omit. compute alpha=make(1,1,0). compute mdiff=make(1,1,0). compute sd=make(1,1,0). compute n=make(1,1,0). compute rho=make(1,1,0). compute alpha=m(:,1). compute mdiff=m(:,2). compute sd=m(:,3). compute n=m(:,4). compute rho=m(:,5). end matrix. COMPUTE power = 1 - NCDF.T(IDF.T(1-alpha/2,n+n-2),n+n-2,(mdiff)/SQRT((2*sd*sd/n)*(1-rho))). exe. formats n (f7.0) rho (f7.2) alpha (f5.2) mdiff (f5.2) sd (f5.2) power (f5.2). variable labels n 'Sample Size 1' /rho 'Correlation' /alpha 'Alpha' /mdiff 'Mean Difference' /sd 'SD' /power 'Power'. report format=list automatic align(center) /variables=n rho alpha mdiff sd power /title "Paired t-test power for given sample size" .
In R we need just one line:
For 394 pairs (n), an average paired difference (delta) of 0.2, a difference s.d. (sd) of 1, a and a two-sided type I error (sig.level)of 0.05 we find that we have approx. 98% power.
power.t.test(n=394,delta=0.2,sd=1,sig.level=0.05,type=c("paired"),alternative=c("two.sided"))