📝 Problem
Given: n = 5, Σx = 15, Σy = 20, Σxy = 66, Σx² = 55, Σy² = 86. Find both regression lines and r.
Unit IV · Lecture 31 of 40 · B.Sc. Data Science, 1st Year, Semester II
Correlation measures the strength and direction of the linear relationship between two variables. It is symmetric — r(x,y) = r(y,x).
Regression goes further: it provides an equation to predict one variable from the other. It is not symmetric — the regression of y on x is different from the regression of x on y.
Correlation tells you that two cities are connected by a road (the relationship exists and is strong). Regression gives you the GPS directions — the exact equation to get from one city to the other (predict y from x). And the directions from A to B are different from B to A — just like two different regression lines.
The term "regression" was coined by Sir Francis Galton, who studied the heights of parents and their children. He found that tall parents tended to have children shorter than themselves, and short parents tended to have taller children — children's heights regressed toward the mean. He called this "regression toward the mean."
Equation: y − ȳ = bᵧₓ(x − x̄)
Slope (bᵧₓ): = r · (Sᵧ / Sₓ)
Or: bᵧₓ = [nΣxy − ΣxΣy] / [nΣx² − (Σx)²]
Purpose: Predict y given x.
Read as: "y regressed on x"
Equation: x − x̄ = bₓᵧ(y − ȳ)
Slope (bₓᵧ): = r · (Sₓ / Sᵧ)
Or: bₓᵧ = [nΣxy − ΣxΣy] / [nΣy² − (Σy)²]
Purpose: Predict x given y.
Read as: "x regressed on y"
Regression coefficient of y on x (bᵧₓ):
bᵧₓ = Cov(x,y) / Var(x) = [Σ(xᵢ−x̄)(yᵢ−ȳ)] / [Σ(xᵢ−x̄)²]
Regression coefficient of x on y (bₓᵧ):
bₓᵧ = Cov(x,y) / Var(y) = [Σ(xᵢ−x̄)(yᵢ−ȳ)] / [Σ(yᵢ−ȳ)²]
Relationship with correlation:
r² = bᵧₓ × bₓᵧ → r = ±√(bᵧₓ × bₓᵧ)
(Sign of r = sign of both regression coefficients)
bᵧₓ represents the average change in y for a one-unit increase in x.
• If bᵧₓ = 2.5: On average, y increases by 2.5 units for each 1-unit increase in x.
• If bᵧₓ = −1.3: On average, y decreases by 1.3 units for each 1-unit increase in x.
• If bᵧₓ = 0: There is no linear relationship — knowing x doesn't help predict y.
bᵧₓ has units: if y is in kg and x is in cm, then bᵧₓ is in kg/cm.
y − ȳ = bᵧₓ(x − x̄) [point-slope form]
y = (ȳ − bᵧₓx̄) + bᵧₓx [y = a + bx form, where a = ȳ − bᵧₓx̄]
y = aᵧₓ + bᵧₓx [intercept-slope form]
x − x̄ = bₓᵧ(y − ȳ) [point-slope form]
x = (x̄ − bₓᵧȳ) + bₓᵧy [x = a + by form]
x = aₓᵧ + bₓᵧy [intercept-slope form]
Given: n = 5, Σx = 15, Σy = 20, Σxy = 66, Σx² = 55, Σy² = 86. Find both regression lines and r.
x̄ = 15/5 = 3, ȳ = 20/5 = 4
bᵧₓ = [nΣxy − ΣxΣy] / [nΣx² − (Σx)²]
= [5(66) − (15)(20)] / [5(55) − 225]
= 30/50 = 0.6
bₓᵧ = [nΣxy − ΣxΣy] / [nΣy² − (Σy)²]
= [5(66) − (15)(20)] / [5(86) − 400]
= 30/30 = 1.0
r = √(bᵧₓ × bₓᵧ) = √(0.6 × 1.0) = √0.6 = 0.7746
y = 2.2 + 0.6x
x = −1.0 + 1.0y
Q1: The two regression lines intersect at:
Q2: r² equals:
Q3: If r = 0, the regression line of y on x is:
Q4: Regression of y on x minimises:
Q5: The regression coefficient bᵧₓ has units of:
1. Find both regression lines for: x = 2, 4, 6, 8, 10 and y = 3, 7, 5, 11, 9.
2. If bᵧₓ = 1.5 and bₓᵧ = 0.6, find r.
3. If the regression line of y on x is y = 3 + 2x, predict y when x = 10.
4. Explain why the two regression lines are different unless r = ±1.
5. Given x̄ = 10, ȳ = 20, bᵧₓ = 1.5, bₓᵧ = 0.4. Verify that r² = bᵧₓ × bₓᵧ. Find r.
6. BONUS: Show that if we interchange x and y in the regression of y on x, we do NOT get the regression of x on y. Use a numerical example.
Lecture 32: Coefficient of Regression — deeper properties, standard error of estimate, and the relationship between correlation and regression.