Meaning of correlation
Correlation studies how two variables change together. It tells the direction (same or opposite) and strength (how closely) of the relationship.
- Positive correlation: both move the same way. Income ↑, spending ↑.
- Negative correlation: they move opposite ways. Price ↑, demand ↓.
- Zero correlation: no linear pattern.
Correlation is not causation. Two things can move together by chance or because of a third factor. Ice-cream sales and sunburn both rise in summer; one does not cause the other.
Scatter diagram
Plot each pair (x, y) as a dot. The pattern tells the kind of correlation:
- Dots rising from left to right → positive.
- Dots falling → negative.
- All on one rising line → perfect positive (r = +1); on one falling line → perfect negative (r = −1).
- Dots close to a line → high correlation; widely spread → low.
- No pattern → no correlation.
It is quick and visual but gives no exact number.
Karl Pearson's coefficient of correlation (ungrouped data)
r = Σdxdy ÷ √(Σdx² × Σdy²), where dx = x − x̄ and dy = y − ȳ (actual mean method).
Other forms:
- Direct (actual values): r = [nΣxy − ΣxΣy] ÷ √{[nΣx² − (Σx)²][nΣy² − (Σy)²]}.
- Assumed mean / step deviation: use dx = x − A, dy = y − B (or divide by a common factor). r = [nΣdxdy − ΣdxΣdy] ÷ √{[nΣdx² − (Σdx)²][nΣdy² − (Σdy)²]}.
Why it works: when both deviations have the same sign, dx·dy is positive (green rectangles). When they have opposite signs, it is negative (red). The sum decides the sign of r.
Properties of r
- r lies between −1 and +1.
- r has no unit.
- r is not changed by a change of origin (adding or subtracting a number) or a change of scale (multiplying or dividing by a positive number).
- r = 0 means no linear relation; a curved relation may still exist.
- r measures only linear association; it does not show cause and effect.
- The correlation of x with y equals that of y with x.
Spearman's rank correlation
Used when data are ranks, or qualities that cannot be measured (beauty, honesty), or when there are extreme values.
Non-repeated ranks
R = 1 − 6ΣD² ÷ (n³ − n), where D = difference between the two ranks of an item and n = number of pairs. Steps: give ranks (largest = 1 if not given), find D, square, add, put in the formula. Check: ΣD = 0.
Repeated (tied) ranks
When values tie, give each the average of the ranks they would take. Two items sharing 3rd and 4th place each get 3.5. Then add a correction for every tie group of size m:
R = 1 − 6[ΣD² + Σ(m³ − m) ÷ 12] ÷ (n³ − n).
R also lies between −1 and +1. Spearman's R and Pearson's r are equal when there are no ties and ranks are used as data.
Try it: are height and shoe size linked?
Measure the height and shoe size of 6 people at home. Plot them as dots on graph paper. Do the dots rise? Then rank the 6 by height and by shoe size and find Spearman's R. Finally, on the last 3D step, move the slider until the dots look like yours and read r.
Board exam pattern
Expect a 4 or 6-mark numerical on Karl Pearson's r (often by the actual mean or step deviation method), a 3 or 4-mark Spearman's R with ties, and short questions on properties and scatter diagrams. Show the full table: x, y, dx, dy, dx², dy², dxdy.
Key formulas and definitions
- r = Σdxdy ÷ √(Σdx² × Σdy²), dx = x − x̄, dy = y − ȳ
- r = [nΣxy − ΣxΣy] ÷ √{[nΣx² − (Σx)²][nΣy² − (Σy)²]}
- −1 ≤ r ≤ +1
- Spearman: R = 1 − 6ΣD² ÷ (n³ − n)
- Tied ranks: R = 1 − 6[ΣD² + Σ(m³ − m)/12] ÷ (n³ − n)
- ΣD = 0 (check)
Worked examples
1. x: 1, 2, 3, 4, 5 and y: 2, 4, 5, 4, 5. Find Karl Pearson's r.
x̄ = 3, ȳ = 4. dx: −2, −1, 0, 1, 2; dy: −2, 0, 1, 0, 1. Σdxdy = 4 + 0 + 0 + 0 + 2 = 6. Σdx² = 10, Σdy² = 6. r = 6 ÷ √60 = 6 ÷ 7.746 ≈ 0.77.
2. x: 2, 4, 6, 8 and y: 9, 7, 5, 3. Find r.
x̄ = 5, ȳ = 6. dx: −3, −1, 1, 3; dy: 3, 1, −1, −3. Σdxdy = −9 − 1 − 1 − 9 = −20. Σdx² = 20, Σdy² = 20. r = −20 ÷ 20 = −1 (perfect negative).
3. x: 10, 20, 30 and y: 5, 15, 10. Find r by the direct formula.
n = 3, Σx = 60, Σy = 30, Σxy = 50 + 300 + 300 = 650, Σx² = 1400, Σy² = 350. r = (3 × 650 − 60 × 30) ÷ √[(4200 − 3600)(1050 − 900)] = 150 ÷ √(600 × 150) = 150 ÷ 300 = 0.5.
4. Two judges rank 5 dancers: A: 1, 2, 3, 4, 5; B: 2, 1, 4, 3, 5. Find R.
D: −1, 1, −1, 1, 0; ΣD² = 4. R = 1 − 6 × 4 ÷ (125 − 5) = 1 − 24 ÷ 120 = 0.8.
5. Marks in Economics: 50, 60, 60, 70 and in Maths: 30, 45, 40, 50. Find Spearman's R.
Economics ranks (largest = 1): 70 → 1, 60 and 60 share 2 and 3 → 2.5 each, 50 → 4. So ranks: 4, 2.5, 2.5, 1. Maths ranks: 50 → 1, 45 → 2, 40 → 3, 30 → 4, so 4, 2, 3, 1. D: 0, 0.5, −0.5, 0; ΣD² = 0.5. One tie with m = 2: (8 − 2) ÷ 12 = 0.5. R = 1 − 6(0.5 + 0.5) ÷ (64 − 4) = 1 − 6 ÷ 60 = 0.9.
6. r between x and y is 0.6. What is r if every x is multiplied by 10 and 5 is added to every y?
Still 0.6. r does not change with change of origin or (positive) change of scale.
Common mistakes
- Getting r greater than 1. If you do, recheck the table; r can never pass ±1.
- Thinking correlation proves cause. It only shows moving together.
- Forgetting the tie correction (m³ − m)/12 for repeated ranks.
- Using n² instead of n³ − n in Spearman's formula.