How to calculate confidence intervals of correlations with R

November 11, 2010

(This article was first published on Jeromy Anglim's Blog: Psychology and Statistics, and kindly contributed to R-bloggers)

This post sets out how to calculate confidence intervals for correlations using R. Because I often get this question from people unfamiliar with R, it assumes no prior knowledge of R.


  • Online Statsbookhas formulas for calculating the confidence interval of a correlation coefficient.


  1. Download and Install R (R Home Page; Windows Installation)

  2. Start R and run the following commands, updating the CIr command as required:

install.packages("psychometric") # install package with function
library(psychometric) # load package with function

# The following command calculates lower and upper
# 95% confidence intervals (level)
# assuming sample size (n) is 100
# and the obtained correlation (r) is 0.90
CIr(r=.9, n = 100, level = .95)

To leave a comment for the author, please follow the link and comment on their blog: Jeromy Anglim's Blog: Psychology and Statistics. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)