# Power matched pairs

m1 = 140; m2=0; s1 = 210; s2 = 210; rho=0.5; N = 16; alpha=0.05

dz = abs(m1-m2)/sqrt(s1^2 + s2^2 - 2*rho*s1*s2)

d = dz*sqrt(N)

tc = tinv(1-alpha,N-1)

power = 1-nctcdf(tc,N-1,d)

