Correlation Coefficient: Confidence Interval Calculator


Instructions: You can use this step-by-step calculator of confidence interval for the Correlation Coefficient for two variables X and Y. All you have to do is type your X and Y data in the spreadsheet below, and specify the confidence level.

You can paste data directly from Excel, if that is how you have your data.

XY
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Confidence Level (Ex: 0.95, 95, 99, 99%) =
Name of X variable (optional)
Name of Y variable (optional)

Correlation Coefficient Confidence Interval

The correlation coefficient is a statistic (which implies that it is computed from sample data) which provides a numeric measure to quantify the strength of the linear association between two variables. The correlation values, by definition, can range between -1 and 1.

A correlation close to 1 suggests the existence of a strong positive linear association between the two variables, and a correlation close to -1 suggests the existence of a strong negative linear association between the two variables. The closer the correlation is to 1 (or -1), the stronger the linear association is.

How do you compute the Correlation Coefficient

Mathematically, the correlation coefficient is computed as follows:

r=ni=1nxiyi(i=1nxi)(i=1nyi)ni=1nxi2(i=1nxi)2ni=1nyi2(i=1nyi)2r =\frac{n \sum_{i=1}^n x_i y_i - \left(\sum_{i=1}^n x_i \right) \left(\sum_{i=1}^n y_i \right) }{\sqrt{n \sum_{i=1}^n x_i^2 - \left( \sum_{i=1}^n x_i \right)^2} \sqrt{n \sum_{i=1}^n y_i^2 - \left( \sum_{i=1}^n y_i \right)^2} }

which can be more conveniently re-written as:

r=i=1nxiyi1n(i=1nxi)(i=1nyi)i=1nxi21n(i=1nxi)2i=1nyi21n(i=1nyi)2=SSXYSSXXSSYYr = \frac{\sum_{i=1}^n x_i y_i - \frac{1}{n}\left(\sum_{i=1}^n x_i \right) \left(\sum_{i=1}^n y_i \right) }{\sqrt{\sum_{i=1}^n x_i^2 - \frac{1}{n}\left( \sum_{i=1}^n x_i \right)^2} \sqrt{\sum_{i=1}^n y_i^2 - \frac{1}{n}\left( \sum_{i=1}^n y_i \right)^2}} = \frac{SS_{XY}}{\sqrt{SS_{XX}\cdot SS_{YY} }}

Notice that this is suitable for two variables only. Whenever you have more than two variables, you could use our correlation matrix calculator, which will provide you with the correlation matrix, representing the correlation between ALL pairs of variables.

Correlation and Regression

Calculating the correlation coefficient is the first step in assessing the degree of linear association between two variables. The natural first step is to compute its associated confidence interval, so to have an interval where we are very confident that the true population correlation coefficient can be found.

If this confidence interval does not contain 0, it indicates that the correlation is significantly different from zero, in which case we should a regression calculator in order to estimate a linear model.

Can you compute a confidence interval for a correlation coefficient?

Yes! A correlation coefficient does have a confidence interval. Indeed, a sample correlation coefficient is an estimate of a true population correlation, and as such, it is amenable for interval estimates.

Now, the procedure for computing the confidence interval associated to a sample correlation is a bit more convoluted, as it requires the use of certain transformations.

How do you find the correlation coefficient and confidence interval?

Step 1: You need to compute the sample correlation rr, or have it provided to you.

Step 2: Compute a transformation of the correlation coefficient, based on the inverse hyperbolic tangent, defined as r=tanh1(r)r' = \tanh^{-1}(r). This will be the center of an auxiliary confidence interval that will be used.

Step 3: Compute the standard error of the transformed correlation using the following formula:

SE=1n3SE = \frac{1}{\sqrt{n-3}}

where nn represents the sample size.

Step 4: Compute the following auxiliary confidence interval:

CI=(tanh1(r)zc×SE,tanh1(r)+zc×SE)CI' = (\tanh^{-1}(r) - z_c \times SE, \tanh^{-1}(r) + z_c \times SE)

where zcz_c represents the critical value for the given confidence level. For example, for a 95% confidence level, we have that zc=1.96z_c = 1.96.

Step 5: We exponentiate the limits of the auxiliary confidence interval CI', in order to get the confidence interval we are interested in:

CI=(tanh(rzc×SE),tanh(r+zc×SE))CI = (\tanh(r' - z_c \times SE), \tanh(r' + z_c \times SE))

which is how you calculate confidence interval in R.

Confidence interval for correlation coefficient interpretation

The interpretation of the confidence interval for the correlation is about the same as it is for other parameters and sample statistics. For a confidence interval with limits (rL,rU)(r_L, r_U), we can say that we are confident (at the given confidence level), that the interval (rL,rU)(r_L, r_U) contains the true population correlation.

More concretely, with an example. Assume you have a 95% correlation confidence interval with limits (0.34,0.59)(0.34, 0.59), so then we can say that we are 95% confident that the interval (0.34,0.59)(0.34, 0.59) contains the true population correlation.

You can also compute a confidence interval for the correlation when you you already know the correlation coefficient, by providing the sample correlation and the confidence level/

Example

Assume you have the following data for two variables X and Y, compute the 99% confidence interval for the sample correlation coefficient:

X Y
1 2
2 3
3 2
4 3
5 4
6 5
7 6
8 10
9 6
10 7

Solution:

Step 1: Compute the Sample Correlation Coefficient

The independent variable is XX, and the dependent variable is YY. In order to compute the correlation coefficient, the following table needs to be used:

  X Y XYX \cdot Y X2X^2 Y2Y^2
  1 2 2 1 4
  2 3 6 4 9
  3 2 6 9 4
  4 3 12 16 9
  5 4 20 25 16
  6 5 30 36 25
  7 6 42 49 36
  8 10 80 64 100
  9 6 54 81 36
  10 7 70 100 49
Sum = 55 48 322 385 288

Based on the above table, the following is calculated:

Xˉ=1ni=1nXi=5510=5.5\bar X = \frac{1}{n} \sum_{i=1}^{n} X_i = \frac{ 55}{ 10} = 5.5 Yˉ=1ni=1nYi=4810=4.8\bar Y = \frac{1}{n} \sum_{i=1}^{n} Y_i = \frac{ 48}{ 10} = 4.8SSXX=i=1nXi21n(i=1nXi)2=385552/10=82.5\large SS_{XX} = \sum_{i=1}^{n} X_i^2 - \displaystyle\frac{1}{n}\left(\sum_{i=1}^{n} X_i\right)^2 = 385 - 55^2/10 = 82.5SSYY=i=1nYi21n(i=1nYi)2=288482/10=57.6\large SS_{YY} = \sum_{i=1}^{n} Y_i^2 - \displaystyle\frac{1}{n}\left(\sum_{i=1}^{n} Y_i\right)^2 = 288 - 48^2/10 = 57.6SSXY=i=1nXiYi1n(i=1nXi)(i=1nYi)=32255×48/10=58\large SS_{XY} = \sum_{i=1}^{n} X_i Y_i - \displaystyle\frac{1}{n}\left(\sum_{i=1}^{n} X_i\right) \left(\sum_{i=1}^{n} Y_i\right) = 322 - 55 \times 48/10 = 58

Therefore, based on the above calculations, the correlation coefficient is obtained as follows:

r=SSXYSSXXSSYY=5882.557.6=0.841 \begin{array}{ccl} r & = & \displaystyle \frac{ SS_{XY}}{ \sqrt{SS_{XX} \cdot SS_{YY}}} \\\\ \\\\ & = & \displaystyle \frac{ 58 }{ \sqrt{82.5 \cdot 57.6}} \\\\ \\\\ & = & 0.841 \end{array}

Step 2: Compute the Transformation of the Sample Correlation Coefficient

The next step consists of computing the transformation (inverse hyperbolic tangent) of the sample correlation coefficient we just found.

What we are trying to do is to construct a auxiliary confidence interval for a transformation of the correlation, which corresponds to the inverse hyperbolic tangent, from which to derive a confidence interval for the correlation itself. The following is obtained:

r=tanh1(r)=12ln(1+r1r)=12ln(1+0.84110.841)=1.226r' = \tanh^{-1}(r) = \frac{1}{2}\ln\left(\frac{1+r}{1-r}\right) =\frac{1}{2}\ln\left(\frac{1+0.841}{1-0.841}\right) = 1.226

Step 3: Compute the Standard Error

Now we will compute the standard error SESE for the auxiliary confidence interval, using the following formula:

SE=1n3=1103=0.378 SE =\frac{1}{\sqrt{n-3}} = \frac{1}{\sqrt{ 10-3}} = 0.378

where n=10n = 10 corresponds to the sample size (the number of pairs).

Step 4: Compute the Auxiliary Confidence Interval

Now we need to compute the auxiliary confidence interval, which is the confidence interval of the log of the correlation.

The required confidence level is 99%99\%, so then the corresponding critical z-value is zc=2.576z_c = 2.576, which is obtained using a normal distribution table (or your calculator). With this information we compute the lower and upper limits of the auxiliary interval:

With this information we compute the lower and upper limits of the auxiliary interval:

L=rzc×SE=1.2262.576×0.378=0.252 L' = r' - z_c \times SE = 1.226 - 2.576 \times 0.378 = 0.252

and

U=r+zc×SE=1.226+2.576×0.378=2.199 U' = r' + z_c \times SE = 1.226 + 2.576 \times 0.378 = 2.199

so then the auxiliary confidence interval for the transformed correlation is CI=(0.252,2.199)CI' = (0.252, 2.199).

Step 5: Compute the Confidence Interval for the Correlation

Finally, we can compute the 99%99\% we are looking for by applying the hyperbolic tangent function to the limits of the auxiliary confidence interval obtained above:

L=tanh(L)=tanh(0.252)=0.247 L = \tanh(L') = \tanh( 0.252) = 0.247U=tanh(U)=tanh(2.199)=0.976 U = \tanh(U') = \tanh(2.199) = 0.976

Therefore, based on the information provided above, the sample correlation coefficient is r=0.841r = 0.841, and the 99%99\% confidence interval for the sample correlation is CI=(0.247,0.976)CI = (0.247, 0.976).

Interpretation: Based on the results found above, we are 99%99\% confident that the interval (0.247,0.976)(0.247, 0.976) contains the true population correlation ρ\rho.

log in to your account

Don't have a membership account?
REGISTER

reset password

Back to
log in

sign up

Back to
log in