Least Squares Regression Line Math Example 1

Follow the full solution, then compare it with the other examples linked below.

Example 1

medium
Find the least-squares regression line for: (x,y)(x,y): (1,2),(2,4),(3,5),(4,4),(5,5)(1,2), (2,4), (3,5), (4,4), (5,5). Use b=rsysxb = r \frac{s_y}{s_x} and a=yห‰โˆ’bxห‰a = \bar{y} - b\bar{x}.

Solution

  1. 1
    xห‰=3\bar{x} = 3, yห‰=4\bar{y} = 4; sx=2.5โ‰ˆ1.58s_x = \sqrt{2.5} \approx 1.58; sy=1.5โ‰ˆ1.22s_y = \sqrt{1.5} \approx 1.22
  2. 2
    Calculate rr: โˆ‘(xiโˆ’xห‰)(yiโˆ’yห‰)=(โˆ’2)(โˆ’2)+(โˆ’1)(0)+(0)(1)+(1)(0)+(2)(1)=4+0+0+0+2=6\sum(x_i-\bar{x})(y_i-\bar{y}) = (-2)(-2)+(-1)(0)+(0)(1)+(1)(0)+(2)(1) = 4+0+0+0+2=6; r=64ร—sxร—sy=64(1.58)(1.22)=67.71โ‰ˆ0.778r = \frac{6}{4 \times s_x \times s_y} = \frac{6}{4(1.58)(1.22)} = \frac{6}{7.71} \approx 0.778
  3. 3
    Slope: b=rsysx=0.778ร—1.221.58โ‰ˆ0.778ร—0.772โ‰ˆ0.60b = r \frac{s_y}{s_x} = 0.778 \times \frac{1.22}{1.58} \approx 0.778 \times 0.772 \approx 0.60
  4. 4
    Intercept: a=yห‰โˆ’bxห‰=4โˆ’0.60(3)=4โˆ’1.8=2.2a = \bar{y} - b\bar{x} = 4 - 0.60(3) = 4 - 1.8 = 2.2

Answer

y^=2.2+0.60x\hat{y} = 2.2 + 0.60x
The least-squares regression line minimizes the sum of squared residuals. The slope bb represents the expected change in yy for a one-unit increase in xx. The line always passes through (xห‰,yห‰)(\bar{x}, \bar{y}).

About Least Squares Regression Line

The unique straight line y^=a+bx\hat{y} = a + bx that minimizes the sum of squared vertical distances (residuals) between the observed data points and the line.

Learn more about Least Squares Regression Line โ†’

More Least Squares Regression Line Examples