options ps=65; /*This program computes the sample size necessary to achieve target levels of accuracy for squared correlation and partial correlation coefficients such as are reported in Table 2 in Algina and Olejnik (2003). The population squared correlation can be changed by changing .00 in the code rhosq = .00; The number of control variables can be changed by changing 0 in the code q=0; The probability can be changed by changing .95 in the code p=.95; The target levels of accuracy can be changed by changing .05 in the code c = .05; */ data gen; p=.95; q=0; rhosq = .00; c = .05; rhotidsq=rhosq/(1-rhosq); do nn=q+3 to 100000; n=nn; df=n-q-1; df2=n-q-2; rul=rhosq+c; rll=rhosq-c; if rul>=1.0 then rul=.99999; if rll<0 then rll=0; rtul=rul/(1-rul); rtll=rll/(1-rll); gamma=sqrt(1+rhotidsq); phi1=df*(gamma**2-1)+1; phi2=df*(gamma**4-1)+1; phi3=df*(gamma**6-1)+1; g=(phi2-sqrt(phi2**2-phi1*phi3))/phi1; nu=(phi2-2*rhotidsq*gamma*(sqrt(df*df2)))/(g**2); lambda=(rhotidsq*gamma*(sqrt(df*df2)))/(g**2); ul=(df2/(nu*g))*rtul; sl=(df2/(nu*g))*rtll; pu=probf(ul,nu,df2,lambda); pl=probf(sl,nu,df2,lambda); if pu-pl >= p then do; n=nn; output; nn=100000; end; end; proc print; var rhosq q p c n rll rul; title 'The Lee Approximation'; run; quit;