Correlation calculator with every step
Type two lists of numbers. Get Karl Pearson’s r or Spearman’s rank correlation, a scatter plot, and the working you can copy into your answer sheet.
Separate numbers with commas or spaces. Put X and Y pairs in the same order.
High positive correlation: as X goes up, Y tends to go up.
Four decimal places: 0.7746
Guess r!
Look at the dots. Slide to where you think r is, then reveal it.
| X | Y | dx | dy | dx·dy | dx² | dy² |
|---|---|---|---|---|---|---|
| 1 | 2 | -2 | -2 | 4 | 4 | 4 |
| 2 | 4 | -1 | 0 | 0 | 1 | 0 |
| 3 | 5 | 0 | 1 | 0 | 0 | 1 |
| 4 | 4 | 1 | 0 | 0 | 1 | 0 |
| 5 | 5 | 2 | 1 | 2 | 4 | 1 |
| Σ 15 | Σ 20 | 6 | 10 | 6 |
Working
- n = 5 pairs. Mean of X = ΣX ÷ n = 15 ÷ 5 = 3. Mean of Y = 20 ÷ 5 = 4.
- Deviations: dx = X − 3 and dy = Y − 4 (see the table).
- Σdx·dy = 6, Σdx² = 10, Σdy² = 6.
- r = Σdx·dy ÷ √(Σdx² × Σdy²) = 6 ÷ √(10 × 6) = 6 ÷ 7.746 = 0.7746.
- Check with the raw sums: ΣX = 15, ΣY = 20, ΣXY = 66, ΣX² = 55, ΣY² = 86.
- Direct formula: r = (nΣXY − ΣXΣY) ÷ √[(nΣX² − (ΣX)²)(nΣY² − (ΣY)²)] = 30 ÷ 38.7298 = 0.7746. Both methods agree.
Common mistakes in the exam
- Tied values get the average of the ranks they share. Two values tied for 2nd and 3rd both get 2.5.
- For each group of m tied values, add (m³ − m) ÷ 12 to ΣD². Do it for every group, in both lists.
- r always lies between −1 and +1. If you get a value outside that range, you have made an arithmetic slip.
- Correlation is not causation. A high r says the two move together, not that one causes the other.
- Rank both lists in the same direction. Both largest = 1, or both smallest = 1.
How it works
Correlation measures how closely two lists move together in a straight line. Both answers always fall between −1 and +1. Near +1, the points rise together. Near −1, one falls as the other rises. Near 0, there is no straight-line pattern.
Karl Pearson’s r
Find the mean of each list. For every pair, take the deviations dx = X − mean and dy = Y − mean. Then r = Σdx·dy ÷ √(Σdx² × Σdy²). The raw-sums formula gives the same answer, and the calculator checks both.
Spearman’s rank correlation
Give each value a rank, with tied values sharing the average rank. Find D = R1 − R2 for each pair, then rₛ = 1 − 6 × ΣD² ÷ (n³ − n). When there are ties, add (m³ − m) ÷ 12 for each tie group to ΣD² before you divide.
A short worked example
X = 1, 2, 3, 4, 5 and Y = 2, 4, 5, 4, 5. The means are 3 and 4. Σdx·dy = 6, Σdx² = 10 and Σdy² = 6, so r = 6 ÷ √60 = 0.77. That is a high positive correlation.
Pearson or Spearman?
Use Pearson when the numbers are measured values and the link looks roughly straight. Use Spearman when you are given ranks, or when only the order matters.
Learn the chapter
Learning aid. Check the method with your textbook and teacher.
By the ACES team · Last checked 6 November 2026