Correlation and Regression
Core rules
- Karl Pearson r = Σ(x−x̄)(y−ȳ) / √[Σ(x−x̄)² Σ(y−ȳ)²]; it lies between −1 and 1 and is unit-free.
- r > 0 means a positive linear relation; r < 0 negative; r = 0 means no linear relation.
- Spearman rank correlation = 1 − 6Σd²/[n(n²−1)].
- Regression line y on x: y − ȳ = b_yx(x − x̄), where b_yx = r(σy/σx).
- Regression line x on y: x − x̄ = b_xy(y − ȳ), where b_xy = r(σx/σy).
- r² = b_yx × b_xy; the two lines meet at (x̄, ȳ).
Worked example
Given r = 0.8, σx = 2, σy = 3, x̄ = 10, ȳ = 15. Then b_yx = 0.8×3/2 = 1.2. The line is y − 15 = 1.2(x − 10), so y = 1.2x + 3. If x = 12, predicted y = 17.4.
Traps
- Using the y-on-x line to predict x.
- Treating correlation as causation.
- Forgetting that b_yx and b_xy can exceed 1 even though r cannot.
- Rushing rank correlation when ranks are tied; assign average ranks.
- Dropping the means from the regression equation.