**R code – Serious Stats**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

There are various methods for obtaining CIs for Kendall’s tau and Spearman’s rho. As the underlying data are unlikely to be bivariate normal (or else Pearson’s r would be used) bootstrapping is often recommended – but it doesn’t always perform that well (Bishara & Hittner, 2017). One could also use a Fisher *z* transformation. This makes intuitive sense for rho because it is equivalent to Pearson’s *r* following a rank transformation. However, the Fisher *z* transformation isn’t ideal here because ranks will have a rather flat, leptokurtotic distribution relative to data sampled from a bivariate normal distribution. It turns out there are some simple corrections that have good properties in these cases.

Fieller et al. (1957) proposed corrections to the Fisher *z* standard error for both tau and rho that are recommended for absolute values of rho or tau of up to 0.8. Bonett and Wright (2000) propose an alternative correction for rho (though the results are very similar).

Bishara and Hittner (2017) compare the approaches for rho and find that the Fieller correction and a correction using the rankit transformation (scaling the ranks from 0 to 1 and apply a profit transformation; equivalent to estimating the normal quantiles as one might for a quantile-quantile plot) works well. However, they note that other simulation studies favour the Bonett-Wright correction.

The follow R code snippet implements these corrections for – requiring the observed tau or rho and *N* (numbers of paired observations) or, for the rankit transformation, raw data as input: e.g., rho.ci(.63, 35) or spearmen.test(x_vector, y_vector):

Code snippet for rho and tau CIs

## References

Bishara, A. J., Hittner, J. B. (2017). Confidence intervals for correlations when data are not normal. *Behavioral Research Methods, **49***, **294–309 . https://doi.org/10.3758/s13428-016-0702-8

Bonett, D. G., & Wright, T. A. (2000). Sample size requirements for estimating Pearson, Kendall and Spearman correlations. *Psychometrika, 65,* 23–28.

Fieller, E. C., Hartley, H. O., & Pearson, E. S. (1957). Tests for rank correlation coefficients: I. *Biometrika, 44,* 470–481.

**leave a comment**for the author, please follow the link and comment on their blog:

**R code – Serious Stats**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.