options linesize=75 pagesize=54 nodate pageno=1 ; /* This program is adapted from the example in Dr. Johnson's book on page 39. n = sample size, r = sample correlation, conf = confidence level (.95, etc) */ data corrci ; input n r conf ; u = -probit( (1-conf)/2) ; rtilde = r/sqrt(1 -r**2) ; a = 2*n -3 -u**2 ; b = rtilde*sqrt( (2*n -3)*(2*n -5)) ; c = (2*n -5 -u**2)*rtilde**2 -2*u**2 ; y1 = (2*b -sqrt(4*b**2 -4*a*c))/(2*a) ; y2 = (2*b +sqrt(4*b**2 -4*a*c))/(2*a) ; /* llruben = lower confidence limit for Ruben's approximation, ulruben = upper confidence limit for Ruben's approximation, llfisher = lower confidence limit for Fisher's approximation, ulfisher = upper confidence limit for Fisher's approximation */ llruben = y1/sqrt(1 +y1**2) ; ulruben = y2/sqrt(1 +y2**2) ; itanhr = .5*log( (1 +r)/(1 -r)) ; llfisher = tanh(itanhr -u/sqrt(n-3)) ; ulfisher = tanh(itanhr +u/sqrt(n-3)) ; cards ; 6 .8 .95 25 .7 .95 ; proc print ; var n r conf llfisher ulfisher llruben ulruben ; title 'Approximate confidence intervals for rho' ; run ;