I googled and searched on stats.stackexchange but I cannot find the formula to calculate a 95% confidence interval for an $R^2$ value for a linear regression. Can anyone provide it?

Even better, let's say I had ran the linear regression below in R. How would I calculate a 95% confidence interval for the $R^2$ value using R code.

lm_mtcars <- lm(mpg ~ wt, mtcars)
  • 1
    $\begingroup$ Well you know the relationship between the correlation $r$ and $R^2$ is that you are squaring the correlation coefficient to get $R^2$ so why not calculate the confidence interval for $r$ and then square the lower and upper limits of the interval? $\endgroup$
    – user30490
    Oct 1, 2015 at 13:22
  • 2
    $\begingroup$ @ZERO: that will work in a simple linear regression, that is, with a single predictor and an intercept. It won't work for multiple linear regression with more than one predictor. $\endgroup$ Oct 1, 2015 at 13:25
  • $\begingroup$ @StephanKolassa, very true! I guess I was basing it off of his R code where there is only one regressor but that is a very good point to clarify. $\endgroup$
    – user30490
    Oct 1, 2015 at 13:39
  • $\begingroup$ danielsoper.com/statcalc/formulas.aspx?id=28 $\endgroup$
    – Tomas
    Jan 28, 2017 at 20:09
  • $\begingroup$ You can e.g. use a very small R function github.com/mayer79/R-confidence-intervals-R-squared based on properties of the non-central F-distribution. $\endgroup$
    – Michael M
    Aug 16, 2017 at 19:50

2 Answers 2


You can always bootstrap it:

> library(boot)
> foo <- boot(mtcars,function(data,indices)

> foo$t0
[1] 0.7528328

> quantile(foo$t,c(0.025,0.975))
     2.5%     97.5% 
0.6303133 0.8584067

Carpenter & Bithell (2000, Statistics in Medicine) provide a readable introduction to bootstrapping confidence intervals, though not specifically focused on $R^2$.

  • 1
    $\begingroup$ (+1) It might be of interest that the approximate formula quoted by @Durden, with $n=32$ and $k=1$ gives the interval $(0.546,0.960)$. It would be almost perfectly correct if we drop the factor of $2$ multiplying the SE in that formula! $\endgroup$
    – whuber
    Aug 16, 2017 at 19:57
  • $\begingroup$ May also be worth noting that you can get other types of confidence interval (e.g., BCa) from the bootstrap resampling distribution using boot.ci(). $\endgroup$ Mar 3, 2019 at 21:37

In R, you can make use of the CI.Rsq() function provided by the psychometric package. As for the formula it applies, see Cohen et al. (2003), Applied Multiple Regression/Correlation Analysis for the Behavioral Sciences, p. 88:

$SE_{R^{2}} = \sqrt{\frac{4R^{2}(1-R^{2})^{2}(n-k-1)^{2}}{(n^2 - 1)(n+3)}}$

Then, the 95% CI is your $R^{2} \pm 2 \cdot SE_{R^{2}}$.

  • 3
    $\begingroup$ (1) $(1-R^2)$ is squared in your reference. (2) It is important to note that "$R^2$" is intended to be the sample value rather than the population value (which clearly is what "$R^2$" refers to in the question, whence the potential for confusion). (3) It is also important that this is only an asymptotic ("large-sample") result, giving "adequate approximations" for "$n-k-1 \gt 60$". (I believe $k+1$ counts an intercept plus the number of independent variables.) It would be useful to see a worked example supported by simulation, because this interval looks too wide. $\endgroup$
    – whuber
    Aug 16, 2017 at 18:59
  • $\begingroup$ According to Wishart (1931) the formula is unsuitable for nonnormal distributions. $\endgroup$
    – abukaj
    Feb 7, 2018 at 21:37
  • $\begingroup$ Is there an approximation available for non-normal distributions? $\endgroup$
    – jwdietrich
    Nov 28, 2020 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.