mdiff is the difference between the two variables with correlation, rho, type I error, alpha, and (common) sd.
[COPY AND PASTE INTO R AND ADJUST INPUTS AS DESIRED]
pow <- 0.8 beta <- 0.05 mdiff <- 2 sd <- 4 rho <- 0.5
[THEN COPY AND PASTE THE BELOW INTO R] [OUTPUTS NUMBER OF PAIRS]
fn <- function(n) { (pow - (1 - pt(abs(qt(beta/2,(2*n)-2)),2*n-2, mdiff/sqrt((2*sd*sd)/n*(1-rho)))) )^2 } nout<- nlm(fn,2) nout<- trunc(nout$estimate+1) print(nout) pow <- 0.8 alpha <- 0.05 mdiff <- 2 sd <- 4 rho <- 0.5