Why does the OLS regression line always pass through the mean of the independent and dependent variables?

Quick Overview

Asks why an ordinary least squares line fit with an intercept always passes through the mean of x and the mean of y. Tests whether you can derive the result from the first-order condition on the intercept and say which models keep or lose the property.

Why does the OLS regression line always pass through the mean of the independent and dependent variables?

Role: Data Scientist

Category: Machine Learning

Difficulty: medium

Interview Round: Other

Why does the ordinary least squares (OLS) regression line always pass through the point $(\bar{x}, \bar{y})$, the mean of the independent and dependent variables? ```hint Start from the loss Write the sum of squared residuals and differentiate it with respect to the intercept. Ask what setting that derivative to zero says about the residuals. ``` ```hint Then average Average the fitted equation over all data points and compare the result with the line evaluated at the mean of x. ``` ### What a Strong Answer Covers - The first-order condition that drives the result, and which parameter it comes from - The algebra that links that condition to the point of means - The models where the property holds and where it fails - A concrete check, numeric or geometric ### Follow-up Questions - Does the property carry over to multiple regression, and through which point does the fitted plane pass? - Does ridge regression with an unpenalized intercept still pass through the means? - If you regress $\log y$ on $x$, through which point does the fitted line pass? - A model has no intercept but includes a dummy variable for every category. Do its residuals sum to zero?

Overview: Asks why an ordinary least squares line fit with an intercept always passes through the mean of x and the mean of y. Tests whether you can derive the result from the first-order condition on the intercept and say which models keep or lose the property.

Nov 25, 2026
mediumData ScientistOtherMachine Learning
0
0

Why does the ordinary least squares (OLS) regression line always pass through the point (xˉ,yˉ)(\bar{x}, \bar{y}), the mean of the independent and dependent variables?

What a Strong Answer Covers Guidance

  • The first-order condition that drives the result, and which parameter it comes from
  • The algebra that links that condition to the point of means
  • The models where the property holds and where it fails
  • A concrete check, numeric or geometric

Follow-up Questions Guidance

  • Does the property carry over to multiple regression, and through which point does the fitted plane pass?
  • Does ridge regression with an unpenalized intercept still pass through the means?
  • If you regress log⁡y\log y on xx , through which point does the fitted line pass?
  • A model has no intercept but includes a dummy variable for every category. Do its residuals sum to zero?