The formula is relatively simple and can be found in any statistics textbook but tracking it down and computing it by hand every time can be somewhat cumbersome. Here is a short R function to do it easily.
r.cint <- function(r,n,level=.95) {
z <- 0.5*log((1+r)/(1-r))
zse <- 1/sqrt(n-3)
zmin <- z - zse * qnorm((1-level)/2,lower.tail=FALSE)
zmax <- z + zse * qnorm((1-level)/2,lower.tail=FALSE)
return(c((exp(2*zmin)-1)/(exp(2*zmin)+1),(exp(2*zmax)-1)/(exp(2*zmax)+1)))
}The result can also be used as an hypothesis test by checking if the confidence interval includes 0 or not. The conclusion is very similar but not identical to the tests reported by SPSS CORRELATIONS procedure or R cor.test, because these p values are based on another test statistic (and on the t distribution).
What's the point? As is plain to see from the formulas, the standard error of the z-transformed correlation depends only on the sample size (that's the point of the transformation). At a given level, the width of the confidence interval therefore also depends solely on the sample size. With a very small sample size, the point estimate is going to be very imprecise and even an impressive r can hide a modest correlation, whereas a moderate observed correlation could reflect anything from a small correlation in the other direction to a strong correlation in the same direction. If nothing else, the confidence interval makes this imprecision visible and helps to interpret results based on experiments with a very small number of participants.
Bootstrapping techniques can also be used to construct a confidence interval for a correlation coefficient but they require access to the original data set and cannot be computed based only on typical research articles.
Nice one, Gael :-)
ReplyDeleteI just copied your function to my txt file named "handy_functions.R" :)
ReplyDelete