LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (November 2003, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 7 Nov 2003 15:16:06 -0800
Reply-To:     Dale McLerran <stringplayer_2@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Dale McLerran <stringplayer_2@YAHOO.COM>
Subject:      Re: Calculating Confidence Intervals for Correlation
Comments: To: Ying Hu <yhu@MAIL.NIH.GOV>
In-Reply-To:  <3FAC144C.778791C7@mail.nih.gov>
Content-Type: text/plain; charset=us-ascii

Well, for large N, one can employ the asymptotic normality for the Fisher Z transformation. The Fisher Z transformation is

z = 0.5 * ln[(1+r)/(1-r)]

The Z statistic has variance 1/(N-3). Asymptotic confidence limits for the correlation are obtained by computing the confidence limits for the Z statistic and applying the inverse transformation on the Z statistic limits to get limits for the correlation coefficient. Thus, we would compute

z_low = z - 1.96*sqrt(1/(N-3)) z_high = z + 1.96*sqrt(1/(N-3))

The inverse transformation is

r = (exp(2*z) - 1) / (exp(2*z) + 1)

We then convert z_low and z_high to r_low and r_high through this inverse transformation.

Note that these confidence limits are asymptotically correct. However, in small samples the confidence limits computed this way may be markedly off of the true confidence limits. For a sample size of 20, I would probably compute correlation confidence limits using a bootstrap. The bootstrap confidence limits can be computed through the following operations:

data boot_raw / view=boot_raw; set mydata(keep=x y) /* Note: need to dataset reference */ end=lastobs; array _x_ {100} _temporary_; array _y_ {100} _temporary_; _x_{_n_} = x; _y_{_n_} = y; seed=<value between 1 & (2^31 - 1)>; /* Must set seed */ if lastobs then do; do sample=1 to 10000; do i=1 to _n_; point = ceil(ranuni(seed)*_n_); x = _x_{point}; y = _y_{point}; output; end; end; end; keep x y sample; run;

ods listing close; ods output pearsoncorr=boot_corr(rename=(x=corr)); proc corr data=boot_raw; by sample; var x; with y; run;

proc sort data=boot_corr; by corr; run;

data limits; merge boot_corr(firstobs= 250 obs= 250 rename=(corr=corr_low)) boot_corr(firstobs=9751 obs=9751 rename=(corr=corr_high)); keep corr_low corr_high; run;

ods listing; proc print data=limits; run;

The bootstrap process will take some time, but will accurately establish (1-alpha)*100% confidence limits regardless of sample size.

Dale

--- Ying Hu <yhu@MAIL.NIH.GOV> wrote: > Hi all, > How to calculate confidence intervals given correlation coefficient > value and sample size? For example, cc=0.76 and size=20. > Thanks > Ying

===== --------------------------------------- Dale McLerran Fred Hutchinson Cancer Research Center mailto: dmclerra@fhcrc.org Ph: (206) 667-2926 Fax: (206) 667-5977 ---------------------------------------

__________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree


Back to: Top of message | Previous page | Main SAS-L page