FAQ/power/rpt - 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

location: 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)