Why the Data Centroid Matters
A fitted regression line summarizes a pattern in paired predictor and response values. One useful feature of the ordinary least-squares line with an intercept is that it passes through a particular point: the point whose coordinates are the sample mean of the predictor and the sample mean of the response. This point is called the data centroid.
The fact follows from the equations used to choose the least-squares coefficients. It is an algebraic property of the fitted line, not a claim that the line describes every observation well or that a relationship is causal. We will prove the property, calculate it in examples, and distinguish the usual case from the special case where all predictor values are identical.
The Least-Squares Equations Give the Result
For a line with an intercept, write the fitted response at predictor value \(x\) as \(\hat{y}=b_0+b_1x\), where \(b_0\) is the intercept and \(b_1\) is the slope. For observation \(i\), the difference between its observed response and its fitted response is \(e_i=y_i-(b_0+b_1x_i)\). Least squares chooses \(b_0\) and \(b_1\) to minimize the sum of squared differences:
The least-squares equations are obtained by setting the two partial derivatives of \(Q\) equal to zero. This is the defining minimization rule for the fitted coefficients used here; the argument does not require normally distributed responses or any other probability model.
The first equation is enough to establish the centroid property. It says that the sum of the observed-minus-fitted differences is zero. Rearranging that equation and dividing by \(n\) gives the average observed response as the intercept plus the slope times the average predictor value:
But \(b_0+b_1\bar{x}\) is exactly the fitted value from the line when the predictor equals \(\bar{x}\). Therefore, the fitted value there is \(\bar{y}\), and the line passes through \((\bar{x},\bar{y})\). This argument uses the intercept equation; the slope equation is also part of least squares, but it is not needed for this particular conclusion.
When the predictor values are not all equal, the slope formula from the least-squares equations is valid:
The condition shown first is important: it is equivalent to saying that the predictor values are not all equal. If every \(x_i\) has the same value, the denominator of the slope formula is zero, so that formula does not apply. In that case, least squares determines the fitted response at the one observed predictor value, but it cannot determine a unique slope.
Worked Examples
Worked Example: Checking the Centroid With a Calculated Line
Suppose a hypothetical data set records a predictor \(x\) and response \(y\) for four observations. Find the least-squares line and verify that it passes through the centroid.
| Observation | \(x\) | \(y\) |
|---|---|---|
| 1 | 1 | 2 |
| 2 | 2 | 3 |
| 3 | 3 | 5 |
| 4 | 4 | 4 |
First calculate the means and the sums needed for the coefficient formulas:
The predictor values are not all equal, so the slope formula applies. Substitution gives:
The fitted line is \(\hat{y}=1.5+0.8x\). At the mean predictor value \(x=2.5\), it predicts:
Thus the line passes through the centroid \((2.5,3.5)\), as the theorem predicts. The centroid is not itself one of the four observed pairs in this example; the property concerns the fitted line, not whether that point was observed.
Worked Example: Interpreting the Centroid in Context
Imagine hypothetical measurements of study time and quiz score for four students. Let \(x\) be study time in hours and \(y\) be quiz score in points. The data are \((0,50)\), \((1,54)\), \((2,55)\), and \((3,61)\). Calculate the fitted line and explain its centroid property in context.
The required sums are \(\sum x_i=6\), \(\sum y_i=220\), \(\sum x_i y_i=347\), and \(\sum x_i^2=14\). Since the study times vary, the slope is identified:
The fitted line is \(\hat{y}=49.9+3.4x\), where the slope is measured in quiz-score points per hour of study. The mean study time is \(\bar{x}=6/4=1.5\) hours, and the mean score is \(\bar{y}=220/4=55\) points. Substituting the mean study time into the line gives:
So the fitted line passes through \((1.5\text{ hours},55\text{ points})\). This is a mathematical property of the least-squares line for these observations. By itself, it does not show that studying more hours causes a higher score.
Worked Example: When Every Predictor Value Is the Same
Consider hypothetical response values of 8, 10, and 13, all recorded at the same predictor value \(x=5\). Determine what least squares can identify about the fitted line.
The predictor mean is \(\bar{x}=5\), and the response mean is:
Because every predictor value equals 5, the denominator in the slope formula is zero:
A slope cannot be calculated by that formula. Indeed, for any slope \(b_1\), choosing \(b_0=31/3-5b_1\) makes the fitted value at \(x=5\) equal to \(31/3\). That fitted value is the mean response, which minimizes the sum of squared differences from the three responses. Different choices of \(b_1\) and \(b_0\) therefore give the same fitted values for all observed \(x\)-values.
There is no uniquely determined fitted line, but each minimizing line satisfies \(b_0+5b_1=31/3\). Thus every such line passes through the centroid \((5,31/3)\). The centroid property remains true even though the slope is not identified.
What the Property Does—and Does Not—Say
The centroid is a useful check on a calculated least-squares line. If the predictor varies and a proposed line does not satisfy \(b_0+b_1\bar{x}=\bar{y}\), then either the coefficients or the arithmetic should be checked. The result also gives a direct way to interpret the intercept: the line is anchored by the means, while its slope determines how it changes as \(x\) moves away from \(\bar{x}\).
The centroid does not have to be an observed pair. It is formed by averaging the predictor values and response values separately, so its coordinates can combine averages that never occurred together in any one observation. Nor does passing through the centroid guarantee a good fit: the observations might lie far from the line, or their pattern might not be well summarized by a straight line.
The result depends on fitting a line with an intercept by ordinary least squares. If a fitting rule instead forces the intercept to be zero, the least-squares equations change, and the line is not generally required to pass through \((\bar{x},\bar{y})\). The conditions of the fitting procedure matter when applying the theorem.
Common Mistake
Check Your Understanding
Use the definitions and reasoning in this tutorial to answer the following questions.
- For six paired observations, the sample means are \(\bar{x}=4\) minutes and \(\bar{y}=72\) points. What does the centroid property say about the fitted value at \(x=4\)?
- In one sentence, explain why the least-squares equations imply that a fitted line with an intercept passes through \((\bar{x},\bar{y})\).
- Can the centroid be a point that is not one of the observed data pairs? Explain.
- What condition on the predictor values makes the usual least-squares slope formula applicable?
- If all predictor values equal 7, what fitted response does least squares assign at \(x=7\), and why is the slope not uniquely determined?