FAQ/power/rpt - CBU statistics Wiki
Self: FAQ/power/rpt

R code for power for a paired t-test

Alpha is the (two-tailed) type I error, rho is the correlation between the two variables with mean the difference in variable means and sd the (common) sd for each variable.

[COPY AND PASTE INTO R AND THEN ADJUST INPUTS AS DESIRED]

alpha <- 0.05
mean <- 2
sd <- 4
rho <- 0.5
n <- 45

[COPY AND PASTE THE BELOW INTO R]

pow <- 1 - pt(abs(qt(alpha/2, 2*n-2)), 2*n-2,
mdiff/sqrt((2*sd*sd)/n*(1-rho)))
print(pow)

None: FAQ/power/rpt (last edited 2013-03-08 10:17:38 by localhost)