Least-squares regression line: find and interpret it

By Jude Wallis · Published

The least-squares regression line is $\hat{y} = a + bx$. Find the slope with $b = r(s_y/s_x)$ and the intercept with $a = \bar{y} - b\bar{x}$. The slope is the predicted change in y for each one-unit increase in x; the intercept is the predicted y when x is 0.

AP Statistics: Unit 5 (topics 5.3 Linear Regression Models, 5.5 Least-Squares Regression). Least-squares regression is Unit 5 topics 5.3 and 5.5 in the Fall 2026 CED; the redesigned exam expects you to find the slope, intercept, and correlation with technology and interpret the coefficients in context, and it no longer includes inference for regression slopes.

What the least-squares regression line is

The least-squares regression line is the straight line that best fits paired quantitative data by making the total squared prediction error as small as possible. The AP course writes it as y^=a+bx\hat{y} = a + bx, where y^\hat{y} (say "y-hat") is the predicted value of the response variable, xx is the explanatory variable, aa is the y-intercept, and bb is the slope.

The name comes from the rule that picks the line. For every data point, the vertical gap between the observed yy and the predicted y^\hat{y} is a residual. The least-squares line is the single line that minimizes the sum of those residuals squared, which is why it is also called the LSRL, or least-squares regression line. Squaring the gaps makes larger misses count much more, and it makes the best-fit line unique.

One property is worth memorizing: the least-squares line always passes through the point (xˉ,yˉ)(\bar{x}, \bar{y}), where xˉ\bar{x} ("x-bar") is the mean of the x-values and yˉ\bar{y} ("y-bar") is the mean of the y-values. That mean point acts like a pivot the line balances on.

This is Unit 5 material, topics 5.3 and 5.5, and Unit 5 makes up 10 to 20 percent of the multiple-choice section. Keep in mind that y^\hat{y} estimates an average response, not a guaranteed outcome for any one individual.

How to find the least-squares regression line

On the AP exam a graphing calculator with statistical capabilities is expected, and it reports the slope, intercept, and correlation directly. The provided formula sheet gives the line's form, y^=a+bx\hat{y} = a + bx. Seeing how the coefficients come from summary statistics still helps you understand and sanity-check that output.

Start with five summary numbers: the means xˉ\bar{x} and yˉ\bar{y}, the sample standard deviations sxs_x and sys_y (the typical spread of the x-values and of the y-values), and the correlation coefficient rr (a number from -1 to 1 measuring linear strength). The slope comes first:

b=rsysxb = r \cdot \frac{s_y}{s_x}

The slope scales the correlation by the ratio of the two spreads, so it carries units of yy per one unit of xx. Next, the intercept uses the fact that the line runs through (xˉ,yˉ)(\bar{x}, \bar{y}):

a=yˉbxˉa = \bar{y} - b\bar{x}

Compute bb first, then substitute it into the intercept formula. The worked example below runs both steps on a small data set, digit by digit.

How to interpret slope and intercept in context

Interpreting the two coefficients is a common free-response task, and the AP course expects each to be stated in context, not as a bare number.

Slope. The slope bb is the predicted change in the response variable for a one-unit increase in the explanatory variable. Use this template: "For each additional [one unit of x], the model predicts [y] will [increase or decrease] by [b] [units of y]." Say predicted, not actual, and do not claim xx causes the change unless the data came from an experiment. The units matter: a slope of 7.5 points per hour is a complete answer, while "the slope is 7.5" is not.

Intercept. The intercept aa is the predicted response when the explanatory variable equals 0. Use this template: "When [x] is 0 [units], the model predicts [y] is [a] [units]."

The intercept does not always carry a sensible meaning. If x=0x = 0 falls far outside the range of x-values used to fit the line, the intercept is an extrapolation. It can also be impossible in context, such as a negative value for something like height, in which case you say the intercept has no logical interpretation rather than force one.

For the line y^=23.5+7.5x\hat{y} = 23.5 + 7.5x in the worked examples below, where xx is hours spent studying and yy is a quiz score out of 100, the slope reads: for each additional hour of studying, the model predicts the quiz score increases by 7.5 points.

Extrapolation versus interpolation

Once you have the line, predicting looks easy: substitute an x-value and compute y^\hat{y}. The real question is which x-values you can trust.

Interpolation is predicting for an x-value inside the interval of x-values used to build the line. Those predictions are the reliable ones.

Extrapolation is predicting for an x-value beyond that interval. The AP course warns that a predicted value is less reliable the further you extrapolate, because no data out there confirms the trend keeps going. A line fit to study times from 1 to 5 hours says nothing trustworthy about 12 hours, and it can produce impossible values like a quiz score above 100.

In the worked examples, predicting a score for 3.5 hours of studying is interpolation because 3.5 sits between 1 and 5, while predicting for 12 hours is extrapolation and returns 113.5 points, off the 100-point scale.

Common mistakes with the regression line

A handful of slips show up over and over on this topic.

  • Confusing the slope with the correlation. The correlation rr has no units and stays between -1 and 1, while the slope bb carries units and can be any size. They share a sign but answer different questions.
  • Predicting x from y. The line y^=a+bx\hat{y} = a + bx predicts yy from xx. You cannot rearrange it to read an x-value off a y-value and expect the least-squares fit to hold.
  • Dropping the word predicted. The slope and intercept describe predicted values. Writing "the score goes up 7.5 points" as if it were guaranteed misses what regression actually claims.
  • Rounding too early. Keep extra decimals in sxs_x, sys_y, and rr through the slope and intercept steps, and round only the final coefficients.

Check your work and go further

To skip the arithmetic, paste your data into the regression calculator and read off aa, bb, rr, and r2r^2. Working the line out by hand once builds the intuition; after that, let technology do the computing on the exam.

The square of the correlation, r2r^2, is the share of the variation in yy that the line explains; for this data r20.987r^2 \approx 0.987, about 98.7 percent. The guide on r versus r-squared explains the difference between the two. To watch a single unusual point drag the whole line, open the influential point interactive, and to check whether a line was even the right model, see how to interpret residual plots.

Find the least-squares regression line from five data points

Five students recorded the hours they spent studying, xx, and their score on a 100-point quiz, yy: (1, 30), (2, 40), (3, 45), (4, 55), (5, 60). Find the least-squares regression line y^=a+bx\hat{y} = a + bx.

  1. Find the means. xˉ=1+2+3+4+55=155=3\bar{x} = \frac{1+2+3+4+5}{5} = \frac{15}{5} = 3 hours and yˉ=30+40+45+55+605=2305=46\bar{y} = \frac{30+40+45+55+60}{5} = \frac{230}{5} = 46 points.

  2. Find each deviation from its mean. For xx: 2,1,0,1,2-2, -1, 0, 1, 2. For yy: 16,6,1,9,14-16, -6, -1, 9, 14.

  3. Build three sums. (xxˉ)2=4+1+0+1+4=10\sum (x-\bar{x})^2 = 4+1+0+1+4 = 10; (yyˉ)2=256+36+1+81+196=570\sum (y-\bar{y})^2 = 256+36+1+81+196 = 570; (xxˉ)(yyˉ)=32+6+0+9+28=75\sum (x-\bar{x})(y-\bar{y}) = 32+6+0+9+28 = 75.

  4. Find the sample standard deviations. sx=10/4=2.51.5811s_x = \sqrt{10/4} = \sqrt{2.5} \approx 1.5811 and sy=570/4=142.511.9373s_y = \sqrt{570/4} = \sqrt{142.5} \approx 11.9373.

  5. Find the correlation. r=7510570=755700=7575.49830.9934r = \frac{75}{\sqrt{10 \cdot 570}} = \frac{75}{\sqrt{5700}} = \frac{75}{75.4983} \approx 0.9934.

  6. Find the slope. b=rsysx=0.993411.93731.5811=0.99347.55007.5b = r \cdot \frac{s_y}{s_x} = 0.9934 \cdot \frac{11.9373}{1.5811} = 0.9934 \cdot 7.5500 \approx 7.5.

  7. Find the intercept. a=yˉbxˉ=467.53=4622.5=23.5a = \bar{y} - b\bar{x} = 46 - 7.5 \cdot 3 = 46 - 22.5 = 23.5.

The least-squares regression line is y^=23.5+7.5x\hat{y} = 23.5 + 7.5x. As a check, at x=xˉ=3x = \bar{x} = 3 it gives y^=23.5+22.5=46=yˉ\hat{y} = 23.5 + 22.5 = 46 = \bar{y}, confirming the line passes through (xˉ,yˉ)=(3,46)(\bar{x}, \bar{y}) = (3, 46).

Interpret the slope and intercept, then predict

Use the line y^=23.5+7.5x\hat{y} = 23.5 + 7.5x from the previous example, where xx is hours spent studying and yy is a quiz score out of 100. Interpret the slope and intercept in context, predict the score for a student who studies 3.5 hours, and explain why a prediction for 12 hours is unreliable.

  1. Interpret the slope. b=7.5b = 7.5, so for each additional hour of studying, the model predicts the quiz score increases by 7.5 points.

  2. Interpret the intercept. a=23.5a = 23.5, so the model predicts a score of 23.5 points for a student who studies 0 hours. Because 0 hours is outside the observed range of 1 to 5 hours, this is extrapolation and should be read with caution.

  3. Predict for 3.5 hours, which is interpolation since 3.5 is between 1 and 5. y^=23.5+7.53.5=23.5+26.25=49.75\hat{y} = 23.5 + 7.5 \cdot 3.5 = 23.5 + 26.25 = 49.75 points.

  4. Predict for 12 hours, which is extrapolation. y^=23.5+7.512=23.5+90=113.5\hat{y} = 23.5 + 7.5 \cdot 12 = 23.5 + 90 = 113.5 points, which is impossible on a 100-point quiz.

The slope means the predicted score rises 7.5 points per additional hour studied. The intercept of 23.5 points is the predicted score at 0 hours, but 0 lies outside the data, so it is an extrapolation. The predicted score at 3.5 hours is 49.75 points. The 12-hour prediction of 113.5 points exceeds the 100-point maximum, showing why extrapolating beyond the data is unreliable.

Frequently asked questions

What is the difference between y and y-hat?

The observed value yy is the actual data point you measured. The predicted value y^\hat{y} ("y-hat") is what the regression line estimates for that x-value. Their difference, yy^y - \hat{y}, is the residual for that point.

Do I have to compute the regression line by hand on the AP exam?

Usually no. A graphing calculator with statistical capabilities is expected, and it reports the slope, intercept, rr, and r2r^2 directly, while the formula sheet provides the line's form y^=a+bx\hat{y} = a + bx. Knowing the summary-statistic formulas still helps you interpret and check the output.

Why does the regression line always pass through the mean point?

The intercept is defined as a=yˉbxˉa = \bar{y} - b\bar{x}, which rearranges to yˉ=a+bxˉ\bar{y} = a + b\bar{x}. That equation says the point (xˉ,yˉ)(\bar{x}, \bar{y}) lies exactly on the line, so every least-squares line runs through the mean of x and the mean of y.

Is the slope the same as the correlation?

No. The correlation rr is unitless and ranges from -1 to 1, while the slope b=r(sy/sx)b = r(s_y/s_x) carries units and can be any size. They always share the same sign, but only the slope tells you how much y^\hat{y} changes per one-unit increase in xx.