Z Table

Correlation Coefficient Calculator

The Pearson correlation coefficient r measures the strength and direction of a straight-line relationship between two variables, from −1 to +1. It is r = Σ(x − x̄)(y − ȳ) ÷ √(Σ(x − x̄)² × Σ(y − ȳ)²). Paste paired x and y values to get r, r², the two-tailed p-value and the least-squares line. The sample data (Anscombe’s first data set) gives r = 0.8164 and p = 0.0022.

Separate numbers with commas, spaces or new lines.
Same count as x, in the same order.

Pearson r

0.8164

r²

0.6665

Two-tailed p-value

0.0022

Pairs (n)

11

Slope

0.5001

Intercept

3.0001

Working

  1. n = 11; x̄ = 9, ȳ = 7.5009
  2. Sxx = 110, Syy = 41.2727, Sxy = 55.01
  3. r = Sxy ÷ √(Sxx × Syy) = 0.8164; r² = 0.6665
  4. Line of best fit: y = 3.0001 + 0.5001 x
  5. t = r × √(n − 2) ÷ √(1 − r²) = 4.241 with 9 degrees of freedom; two-tailed p = 0.0022

Example: Anscombe’s first data set (11 pairs)

  • n = 11; x̄ = 9, ȳ = 7.5009
  • Sxx = 110, Syy = 41.2727, Sxy = 55.01
  • r = Sxy ÷ √(Sxx × Syy) = 0.8164; r² = 0.6665
  • Line of best fit: y = 3.0001 + 0.5001 x
  • t = r × √(n − 2) ÷ √(1 − r²) = 4.241 with 9 degrees of freedom; two-tailed p = 0.0022

Reading r and the p-value

r near +1 means y rises with x, near −1 means y falls as x rises, and near 0 means no linear relationship. r² is the share of the variation in y explained by the straight line. The p-value tests H₀: ρ = 0 with t = r√(n − 2) ÷ √(1 − r²) and n − 2 degrees of freedom. For the sample data, n = 11 gives 9 degrees of freedom.

Correlation is not causation, and r only measures linear association: a strong curved pattern can give r near 0. Outliers can move r a lot, so plot the data first. Anscombe’s four famous data sets have almost the same r, 0.816, yet look completely different on a plot.

Assumptions

The test assumes paired observations that are independent of each other, and for small samples a roughly bivariate normal distribution. The calculator needs at least 3 pairs and returns an error when all x values, or all y values, are identical, because the correlation is undefined then. Rank-based correlations such as Spearman’s are a better choice for ordinal data or strong outliers.

Frequently asked questions

What is a good correlation coefficient?
It depends on the field. As a rough guide, |r| above 0.7 is strong, 0.3 to 0.7 moderate and below 0.3 weak, but significance also depends on n.
Does correlation imply causation?
No. Two variables can move together because of a third variable or by chance.
What is r squared?
The proportion of the variance in y that the straight line with x accounts for.
How many pairs do I need?
At least 3 to compute a p-value, but small samples give wide uncertainty; the p-value tests whether r differs from 0.

Sources and references