Tutorials › AP Statistics › Properties of the Least-Squares Line

Least-squares regression · Tutorial 873 of 1000

Properties of the Least-Squares Line

Learn how the mean point, the balance of signed residuals, and the relationship between slope and correlation help you check and understand a least-squares line.

Intermediate 9 min read

What You'll Learn

  • Verify that a least-squares line with an intercept passes through the point of the sample means.
  • Explain why the signed residuals for the fitted data sum to zero.
  • Distinguish a zero residual sum from every residual being zero.
  • Use the slope formula to connect the sign of the regression slope to the sign of \(r\).
  • Identify when these properties apply and how rounding can affect a numerical check.

Three Useful Checks on a Least-Squares Line

A least-squares regression line summarizes the linear pattern in a set of paired data. In “Prediction Versus Observed Values,” you learned that a residual is the observed response minus the predicted response, \(y-\hat{y}\). Looking at all the residuals together reveals a few important properties of the fitted line. These properties can help you check a calculation and interpret how the line relates to the data.

For a least-squares line with an intercept, three facts are especially useful: the line passes through the point \((\bar{x},\bar{y})\), the signed residuals for the fitted data sum to zero, and the slope \(b\) has the same sign as the correlation \(r\) when both variables vary. These are properties of the line fitted to the data, not guarantees that every individual point lies on the line.

Key properties: For a least-squares regression line with an intercept, \(\hat{y}=a+bx\):
  • At \(x=\bar{x}\), the predicted value is \(\hat{y}=\bar{y}\). Thus, the line passes through \((\bar{x},\bar{y})\).
  • For the observations used to fit the line, the signed residuals sum to zero: \(\sum (y-\hat{y})=0\).
  • When both \(x\) and \(y\) vary, \(b=r(s_y/s_x)\), so the slope \(b\) and correlation \(r\) have the same sign.

The Line Passes Through the Point of the Means

The point \((\bar{x},\bar{y})\) combines the sample mean of the explanatory variable with the sample mean of the response variable. It is a point on the least-squares regression line. In other words, if you substitute \(\bar{x}\) into the line, the predicted response is \(\bar{y}\):

$$ \hat{y}=a+b\bar{x}=\bar{y}. $$

This agrees with the earlier tutorial “Finding the Line Through the Means,” which used the identity \(a=\bar{y}-b\bar{x}\). Here, the mean point is also a useful check: if you have the line and the sample means, substitute \(\bar{x}\) and see whether the result is \(\bar{y}\). A mismatch may indicate an arithmetic error or coefficients rounded for display.

The mean point is not necessarily an observed case. For example, \(\bar{x}\) might be a value that no individual in the sample had. The property says that the line passes through the averages, not that the sample contains an observation at those averages.

Worked Example: Checking the Mean Point

A fictional study relates daily practice time \(x\), in hours, to a performance score \(y\), in points. The sample means are \(\bar{x}=8.4\) hours and \(\bar{y}=31.2\) points. The least-squares line is \(\hat{y}=10.2+2.5x\). Check whether the line passes through the point of the means.

State. The mean point is \((8.4,31.2)\), with practice time as the \(x\)-coordinate and performance score as the \(y\)-coordinate.

Plan. Substitute \(\bar{x}=8.4\) into the line. If the predicted response equals \(\bar{y}=31.2\), the mean point lies on the line.

Do.

$$ \hat{y}=10.2+2.5(8.4) =10.2+21 =31.2\text{ points}. $$

Conclude. At the sample mean practice time of 8.4 hours, the line predicts the sample mean score of 31.2 points. The line therefore passes through \((8.4,31.2)\), as expected for a least-squares line with an intercept.

Why the Signed Residuals Sum to Zero

For each observed case, the residual is \(y-\hat{y}\). Residuals above the line are positive, and residuals below the line are negative. In the data used to fit a least-squares line with an intercept, the positive and negative signed residuals balance exactly, so their sum is zero:

$$ \sum (y-\hat{y})=0. $$

This is a statement about the signed residuals. It does not say that the distances from the line add to zero, or that the residuals all equal zero. Positive and negative values can cancel even when individual residuals are not small. The mean residual is also zero because the sum of the residuals divided by the number of observations is zero.

The property applies to the same observations used to fit the line. It does not claim that residuals for a new set of cases, or for future predictions, must sum to zero. It also relies on fitting a line with an intercept; a regression forced through the origin does not generally have this residual-sum property.

Worked Example: Checking the Residual Sum

A fictional sports program records weekly practice hours \(x\) and skill points \(y\) for three participants. The observed pairs are \((1,3)\), \((2,5)\), and \((3,8)\). Find the least-squares line and check that the residuals sum to zero.

State. We will use \(x\) for practice hours and \(y\) for skill points. The three observations are the data being fitted.

Plan. Find the slope from the centered data, then use \(a=\bar{y}-b\bar{x}\) to find the intercept. Calculate each prediction and residual using \(y-\hat{y}\), and add the residuals.

Do. The means are \(\bar{x}=2\) hours and \(\bar{y}=16/3\) points. The sum of products of deviations is \(5\), and the sum of squared \(x\)-deviations is \(2\), so the slope is:

$$ b=\frac{5}{2}=2.5. $$

The intercept is:

$$ a=\bar{y}-b\bar{x} =\frac{16}{3}-2.5(2) =\frac{1}{3}. $$

Thus, the least-squares line is \(\hat{y}=\frac{1}{3}+2.5x\). Its predictions and residuals are:

\(x\)Observed \(y\)Predicted \(\hat{y}\)Residual \(y-\hat{y}\)
13\(17/6\)\(1/6\)
25\(16/3\)\(-1/3\)
38\(47/6\)\(1/6\)

The sum of the signed residuals is:

$$ \frac{1}{6}-\frac{1}{3}+\frac{1}{6}=0. $$

Conclude. The residuals sum to zero, although none of them is zero. The first and third observations are above the line, and the second is below it; their signed differences balance. The observed responses sum to \(3+5+8=16\), and the predicted responses also sum to \(17/6+16/3+47/6=16\), providing another check on the balance.

The Slope and Correlation Have the Same Sign

In “Linking the Slope to Correlation,” you learned the relationship between the least-squares slope and the correlation:

$$ b=r\left(\frac{s_y}{s_x}\right). $$

When both variables vary, \(s_x\) and \(s_y\) are positive. Therefore, the ratio \(s_y/s_x\) is positive, and multiplying \(r\) by that positive number does not change its sign. A positive \(r\) gives a positive slope, and a negative \(r\) gives a negative slope. If \(r=0\), the slope is zero.

This is a sign relationship, not an equality between the numerical values of \(b\) and \(r\). The slope has units of response units per predictor unit, while \(r\) is unitless. The magnitude of the slope also depends on the relative standard deviations of the two variables. As covered in “Effect of Changing Units on the Regression Line,” changing measurement units can change the slope’s numerical value without changing its direction.

Worked Example: Using the Correlation to Check the Slope’s Sign

A fictional technology test examines screen brightness \(x\), in brightness units, and battery life \(y\), in hours. The sample correlation is \(r=-0.72\), the standard deviation of brightness is \(s_x=10\) units, and the standard deviation of battery life is \(s_y=1.5\) hours. Use the summary statistics to find the slope and explain its sign.

State. Both variables vary, and the correlation is negative. We expect the least-squares slope to be negative.

Plan. Use \(b=r(s_y/s_x)\), keeping the response standard deviation in the numerator and the predictor standard deviation in the denominator.

Do.

$$ b=-0.72\left(\frac{1.5}{10}\right) =-0.72(0.15) =-0.108\text{ hours per brightness unit}. $$

Conclude. The slope is negative, matching the negative correlation. In context, the fitted line predicts lower battery life as screen brightness increases. The slope is measured in hours per brightness unit; it is not the correlation itself.

How to Use These Properties Carefully

These facts are useful checks, but each has a specific meaning. Keep the following distinctions clear when explaining or using them:

  • The mean point is a point on the fitted line. It does not have to be one of the observed data points.
  • The residual sum is a signed total. Opposite signs cancel. A zero sum does not mean the observations all match their predictions.
  • The sign comparison concerns direction. A positive slope and positive \(r\) indicate an upward linear direction; a negative slope and negative \(r\) indicate a downward direction.
  • The slope and correlation have different units and meanings. The slope describes predicted response change per predictor unit. Correlation summarizes the direction and strength of a linear association and has no units.
  • Use the line for the data it fits. The residual-sum property describes the observations used to calculate that least-squares line, not an unrelated sample.

Displayed regression coefficients are often rounded. If you substitute \(\bar{x}\) into an equation with rounded \(a\) and \(b\), the result might be slightly different from \(\bar{y}\). Likewise, adding residuals calculated from rounded predictions might give a small value near zero rather than exactly zero. That small discrepancy can be due to rounding; it does not by itself contradict the least-squares properties. Use full calculator precision when available, and report sensible rounded results.

Common Mistakes and AP Exam Tips

  • Claiming every residual is zero. The property is that the signed residuals sum to zero. A full-credit explanation notes that positive and negative residuals can cancel.
  • Adding absolute residuals instead. The absolute values \(|y-\hat{y}|\) are nonnegative and generally do not sum to zero. The property applies to \(y-\hat{y}\) with its sign preserved.
  • Calling \((\bar{x},\bar{y})\) an observed case. It is the point formed from the two sample means and lies on the line, but it may not correspond to any individual in the data.
  • Saying the slope equals \(r\). The correct relationship is \(b=r(s_y/s_x)\). The positive standard-deviation ratio ensures the same sign when both variables vary.
  • Ignoring the variables’ roles. The slope sign describes the direction of predicted \(y\) as \(x\) increases. Keep the predictor and response fixed when explaining the direction.
  • Overreacting to a small numerical mismatch. Rounded coefficients or predictions can prevent a calculator check from showing exact equality. State that the properties hold for the unrounded least-squares fit and recognize rounding effects.

For an AP-style response, name the property precisely and connect it to the data. For example: “The least-squares line with an intercept passes through \((\bar{x},\bar{y})\), so at the mean practice time the line predicts the mean performance score.” For residuals, specify that the signed residuals for the fitted observations sum to zero. For the slope, state that it has the same sign as \(r\) because \(s_y/s_x\) is positive when both variables vary.

Key takeaway: A least-squares line with an intercept passes through \((\bar{x},\bar{y})\), and its signed residuals for the fitted data sum to zero. When both variables vary, its slope has the same sign as \(r\), since \(b=r(s_y/s_x)\) and the standard-deviation ratio is positive.

Check Your Understanding

Use the properties of a least-squares regression line to answer each question.

  1. A fitted line is \(\hat{y}=4+1.8x\), and \(\bar{x}=5\). What value of \(\bar{y}\) is consistent with the line’s mean-point property?
  2. Three residuals are \(2.4\), \(-1.1\), and \(-1.3\). What is their sum, and does that require every residual to be zero?
  3. A data set has \(r=0.65\), with both \(x\) and \(y\) varying. What must be true about the sign of the least-squares slope? Explain briefly.
  4. A student adds the absolute values of all residuals and gets a positive total. Does this conflict with the residual-sum property? Why or why not?
  5. A calculator’s rounded line gives a prediction at \(\bar{x}\) that differs from \(\bar{y}\) by \(0.01\). Give one reasonable explanation for the difference.