AP Statistics · Topic 5.5 · Reading guide, about 5 min

Fitting the best line: slope, intercept and r^2

Understand the least-squares line, read slope, intercept, r and r squared from output, and interpret them in context.

In one minute

Many lines could be drawn through a scatterplot. The least-squares regression line is the single line that fits best by a specific, agreed-upon standard: it makes the sum of the squared residuals as small as possible. You find it with technology and then interpret what its numbers mean.

Interpretation is the point. The slope, the intercept and r2r^2 each have a standard sentence in context, and each has a trap to avoid.

Key terms

Least-squares regression line (LSRL)
The line y^=a+bx\hat{y} = a + bx that minimizes the sum of the squared residuals.
Slope bb
The predicted change in y for each one-unit increase in x.
Intercept aa
The predicted value of y when x=0x = 0.
Correlation r
The number measuring direction and strength of linear association. The slope has the same sign as r.
Coefficient of determination r2r^2
The proportion of the variation in y accounted for by the linear model using x.
Point (xˉ,yˉ)(\bar{x}, \bar{y})
The point of means. The least-squares line always passes through it.
Computer output
A table from technology listing the constant (intercept), the x coefficient (slope), r or r2r^2, and sometimes other values. Read the values you need.
Residual
y−y^y - \hat{y}. The LSRL is chosen to make the squares of these as small as possible in total.

Why squared residuals

Residuals are positive and negative, so they cancel if you just add them. Squaring makes each one positive and punishes large misses. The least-squares line is the line with the smallest total of squared residuals. Technology computes it; you are not expected to derive the formulas by hand. Two facts help you check output: the line passes through (xˉ,yˉ)(\bar{x}, \bar{y}), and the residuals add to zero.

The slope and r are linked: b=rsysxb = r \dfrac{s_y}{s_x}, so they always have the same sign, and a slope of zero corresponds to r=0r = 0. The intercept follows from the point of means, a=yˉ−bxˉa = \bar{y} - b\bar{x}.

Reading technology output

Software typically reports a constant and a coefficient for x, and an r2r^2 (sometimes r). The constant is a, the intercept. The coefficient on x is b, the slope. Write the equation as y^=a+bx\hat{y} = a + bx, and define x and y in context. If only r2r^2 is shown, take the square root and give it the sign of the slope to get r.

Interpreting slope, intercept and r2r^2

Slope: "For each additional hour of weekly practice, the predicted number of free throws made increases by 0.8." Use predicted or "on average" wording. The slope is a rate that describes the trend, not a promise for any individual.

Intercept: "When weekly practice is 0 hours, the predicted number of free throws made is 1.8." Then judge whether it makes sense. If x=0x = 0 lies outside the data, the intercept is an extrapolation and may have no practical meaning. A predicted price for a car of age 0, or a predicted height for a person of age 0, might be meaningful; a predicted weight at height 0 is not.

**r2r^2:** "About 72.7% of the variation in free throws made is accounted for by the linear relationship with practice hours." The rest is explained by other factors and individual variation. A higher r2r^2 means the line accounts for more of the variation, but it does not by itself show that the line is the right model; always check the residual plot.

Interpretation templates
QuantityTemplate
Slope bFor each one-unit increase in x, the predicted y changes by b units, in context
Intercept aWhen x is 0, the predicted y is a; comment on whether x = 0 makes sense
r2r^2About (r squared as a percent) of the variation in y is accounted for by the linear model with x
ResidualObserved minus predicted, with sign meaning over- or underprediction

Worked example

Using the same invented practice data, (1, 2), (2, 4), (3, 5), (4, 4), (5, 6), technology gives constant 1.8, x coefficient 0.8, and r2=72.7%r^2 = 72.7\%. Here x is weekly practice hours and y is free throws made out of 20.

Equation: y^=1.8+0.8x\hat{y} = 1.8 + 0.8x. Check through the point of means: xˉ=3\bar{x} = 3 and yˉ=4.2\bar{y} = 4.2, and 1.8+0.8(3)=4.21.8 + 0.8(3) = 4.2, so the line passes through (3,4.2)(3, 4.2). Check the slope with r: r=0.8528r = 0.8528, sx=1.5811s_x = 1.5811 and sy=1.4832s_y = 1.4832, so b=0.8528×1.4832/1.5811=0.8b = 0.8528 \times 1.4832/1.5811 = 0.8.

Check r2r^2: the residuals are −0.6,0.6,0.8,−1.0,0.2-0.6, 0.6, 0.8, -1.0, 0.2, with squares 0.36,0.36,0.64,1.00,0.040.36, 0.36, 0.64, 1.00, 0.04 that sum to 2.4. The total variation in y is ∑(y−yˉ)2=8.8\sum(y - \bar{y})^2 = 8.8. Then r2=1−2.4/8.8=0.7273r^2 = 1 - 2.4/8.8 = 0.7273, matching the output and 0.85282=0.72730.8528^2 = 0.7273.

Interpretation: for each additional hour of weekly practice, the predicted number of free throws made increases by 0.8. When practice is 0 hours, the line predicts 1.8 free throws made. Since 0 hours is below the observed range of 1 to 5, this is an extrapolation, though 1.8 is plausible for a beginner. About 72.7% of the variation in free throws made is accounted for by the linear relationship with practice hours; the remaining 27.3% comes from other factors and individual differences.

How it connects

  • Back to 5.2: r2r^2 is r squared, and the slope shares the sign of r.
  • Back to 5.3 and 5.4: the LSRL is the line used for prediction, and it is the line whose residuals are as small as possible overall.
  • Back to 1.7: standard deviations of x and y, used in b=rsy/sxb = r s_y/s_x, are the same ones you computed for a single variable.

Common mistakes

  • Saying slope is a certainty. The slope describes a predicted change; individuals vary around it.
  • Interpreting the intercept blindly. If x=0x = 0 is outside the data, the intercept may be extrapolation or meaningless.
  • **Describing r2r^2 as the percent of points on the line.** It is the proportion of variation in y accounted for by the linear model.
  • **Using r2r^2 alone to approve a model.** A high r2r^2 can accompany a curved residual pattern; check the plot.
  • **Dropping the sign when finding r from r2r^2.** Use the sign of the slope.

How it shows up on the exam

  • Computer output to read: write the equation, interpret slope and intercept in context, and report r from r2r^2.
  • A sentence interpreting r2r^2 in context, in terms of variation in the response.
  • A question about whether the intercept makes sense, or about what the line passes through.

Check yourself

  1. In y^=4.2+1.5x\hat{y} = 4.2 + 1.5x, what does 1.5 say in context, and what would you check before interpreting 4.2?
  2. If r2=0.64r^2 = 0.64 and the slope is negative, what is r?
  3. Why does the least-squares line minimize squared residuals rather than the plain sum of residuals?
  4. How would you explain r2r^2 to a friend in one sentence about "variation"?

Practice this topic. AP Practice questions on exactly what this lesson covers, with an explanation for every answer.