Skip to main content
Daily Math Minute

Exploring Two-Variable Data

Least-Squares Regression

Fitting a regression line to bivariate data and interpreting slope and intercept.

Intermediate20 min lesson3 min readUpdated August 12, 2026Author not yet attributed

Prerequisites

  • Scatterplots & Correlation

Fitting a Line to the Car Value Data

The car age/value data from the last lesson showed an extremely strong negative linear relationship (r ≈ −0.998). Before reading on: with a relationship this strong, would a single specific line — one exact equation — be able to predict a car's value from its age fairly reliably?

Definition — Least-Squares Regression Line

The least-squares regression line ŷ = b₀ + b₁x is the line that minimizes the sum of squared prediction errors (residuals) across all the data points. Its slope, b₁ = Σ(x−x̄)(y−ȳ) / Σ(x−x̄)², reuses the same building blocks as the correlation coefficient — regression and correlation are closely related calculations.
b1=(xxˉ)(yyˉ)(xxˉ)2b_1 = \frac{\sum (x-\bar{x})(y-\bar{y})}{\sum (x-\bar{x})^2}

Worked Example — Fitting and Interpreting the Regression Line

Using Σ(x−x̄)(y−ȳ) = −46 and Σ(x−x̄)² = 17.5 from the previous lesson: b₁ = −46/17.5 ≈ −2.63. The intercept: b₀ = ȳ − b₁x̄ ≈ 15.33 − (−2.63)(3.5) ≈ 24.53. The regression line: ŷ = 24.53 − 2.63x. The slope means: each additional year of age is associated with a resale value about $2,630 lower, on average. The intercept, $24,530, would be the predicted value for a brand-new (age 0) car — a modest extrapolation just past the observed data (which starts at age 1), reasonable here but still worth noting as an assumption rather than an observed value.

Worked Example — Checking the Fit

At age 1, the line predicts ŷ = 24.53 − 2.63(1) ≈ 21.90, versus the actual value of 22 — a residual of about 0.10. At age 6, the line predicts ŷ ≈ 24.53 − 2.63(6) ≈ 8.75, versus the actual value of 9 — a residual of about 0.25. Both predictions land very close to the actual values, consistent with the extremely strong correlation found in the previous lesson.

Graph Visualizer

Domain & range
2
Evaluate a point
  • x^2 = 0

Tip

Small residuals across every data point (as seen here) confirm a strong linear fit — if even one or two residuals were unusually large while the rest were small, that would be worth investigating rather than ignoring.

Common Mistakes

  • Using the regression line to predict a car's value at an age far beyond the observed data, like age 30.

    A regression line is only trustworthy within (or very close to) the range of x actually observed — predicting age 30 assumes the same linear pattern continues indefinitely, which the data can't confirm and which isn't realistic for a car's value anyway (it can't go negative).

Key Takeaways

  • The least-squares regression line minimizes the sum of squared residuals, and its slope shares the same underlying calculation as the correlation coefficient.
  • Slope and intercept have specific, context-based interpretations tied to the variables' actual units.
  • Checking residuals at a few points is a quick way to confirm a line's fit matches what the correlation coefficient already suggests.

Summary

This closes the study of two-variable data. The next unit turns to how data should be collected in the first place, so conclusions drawn from it can be trusted.

Sign in to track your progress and mark this lesson complete.

Track your progress