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.

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 =\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 = \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 \(r\), or have it provided to you.

Step 2: Compute a transformation of the correlation coefficient, based on the inverse hyperbolic tangent, defined as \(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 = \frac{1}{\sqrt{n-3}}\]

where \(n\) represents the sample size.

Step 4: Compute the following auxiliary confidence interval:

\[CI' = (\tanh^{-1}(r) - z_c \times SE, \tanh^{-1}(r) + z_c \times SE)\]

where \(z_c\) represents the critical value for the given confidence level. For example, for a 95% confidence level, we have that \(z_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(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 \((r_L, r_U)\), we can say that we are confident (at the given confidence level), that the interval \((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)\), so then we can say that we are 95% confident that the interval \((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 \(X\), and the dependent variable is \(Y\). In order to compute the correlation coefficient, the following table needs to be used:

  X Y \(X \cdot Y\) \(X^2\) \(Y^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:

\[\bar X = \frac{1}{n} \sum_{i=1}^{n} X_i = \frac{ 55}{ 10} = 5.5\] \[\bar Y = \frac{1}{n} \sum_{i=1}^{n} Y_i = \frac{ 48}{ 10} = 4.8\]\[\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.5\]\[\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.6\]\[\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:

\[ \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' = \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 \(SE\) for the auxiliary confidence interval, using the following formula:

\[ SE =\frac{1}{\sqrt{n-3}} = \frac{1}{\sqrt{ 10-3}} = 0.378\]

where \(n = 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\%\), so then the corresponding critical z-value is \(z_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' = r' - z_c \times SE = 1.226 - 2.576 \times 0.378 = 0.252\]

and

\[ 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)\).

Step 5: Compute the Confidence Interval for the Correlation

Finally, we can compute the \(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\]\[ U = \tanh(U') = \tanh(2.199) = 0.976\]

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

Interpretation: Based on the results found above, we are \(99\%\) confident that the interval \((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