Educerie · AP · Statistics
AP Statistics 5.5
Least-Squares Regression
How can we describe the relationship between two quantitative variables, and how well can one be used to predict the other?
What you will learn
- Understand that the least-squares line minimizes the sum of the squared residuals and passes through the point of the two means
- Know that the slope, intercept, r and r squared come from technology, and that a and b are statistics because they come from a sample
- Understand how to interpret the slope and the intercept in context, and when the intercept has no sensible meaning
- Know that r squared is the proportion of variation in the response explained by the linear relationship
You must be able to
- Interpret the slope in context with predicted, the direction, the amount, the units and for each additional one unit
- Interpret the y-intercept, or explain why it has no sensible meaning
- Interpret r squared as the proportion of variation in the response explained by the linear relationship
- Find r from r squared and the sign of the slope
- Read a, b, r and r squared from technology output
- State what makes the line least squares and where it passes
In the exam. Section I gives a fitted equation with r and and asks which statement is the correct interpretation of the slope, the intercept or , usually inside the regression set of three. Section II can ask you to read the slope, intercept, r and off technology output and to interpret them in context, in words that carry the context mark.
1Which line is "best"?
Any scatterplot with a linear pattern allows many lines. The residual tells how far a line misses each dot (5.4). The least-squares line is chosen so that the total of the squared residuals is as small as possible.
Why square them? Residuals above and below the line have opposite signs and would cancel in a plain sum. Squaring makes every one positive, and it counts a big miss as much worse than a small one.
Figure 1 is invented data for 10 runners: the distance each runs per week, and the time each takes for a 10 km race.
Technology fits the line to the data. Figure 2 compares it with a second line.
Each square has a side equal to one residual, so its area is that residual squared. The lines in (a) and (b) are drawn on the same 10 dots. The total area of the squares is 19.1 for the least-squares line and 25.7 for the line through the two end dots. The least-squares line has the smaller total, and no other line has a smaller one. That is what "least squares" means.
2The equation, from technology
You use technology to calculate , , and . The exam does not ask for a hand formula for either. Calculator output is often in this form:
| Output | Value | Name in statistics |
|---|---|---|
| a | 65.79 | y-intercept |
| b | slope | |
| 0.931 | coefficient of determination | |
| r | correlation coefficient |
The line for the runners is
where is the weekly distance in km and is the predicted 10 km time in minutes. Technology gives full-precision values. If you use rounded ones, rounding errors can show up in the last digit.
Prediction. For a runner who runs 40 km a week:
Remember 5.3: this is interpolation, because 40 is between the 10 and 55 km in the data.
The line passes through . The mean weekly distance is km and the mean time is minutes. Put 32.5 into the line and you get 54.32 back. Figure 1 marks this point on the line.
The slope and intercept are statistics, because they are calculated from a sample of values. A different sample of runners would give a slightly different line.
3Interpreting the slope
The slope is the predicted increase or decrease in the response for a one-unit increase in the explanatory variable. A good interpretation has five parts:
- "predicted" (or "on average"),
- the direction ("increase" or "decrease"),
- the amount, with units,
- "for each additional" one unit of , with its units,
- the variables, in context.
Worked example. The slope of the runners' line is .
For each additional kilometer a runner runs per week, the predicted 10 km race time decreases by about 0.353 minutes.
Over 10 extra kilometers a week the predicted time drops by about 3.5 minutes. The negative sign appears in the word "decreases", so you do not also write "negative decrease".
Careful.
- Say "predicted" or "on average". Do not say "runners who run one more kilometer are 0.353 minutes faster", as if every runner followed it.
- Use the units of both variables: minutes per kilometer run per week.
- Do not say that running more causes the faster time. The data are observational.
4Interpreting the intercept
The y-intercept is the predicted value of the response when the explanatory variable is 0.
For a runner who runs 0 km a week, the predicted 10 km race time is 65.79 minutes.
Always ask whether makes sense in context. Two things can make an intercept meaningless.
- is outside the data (extrapolation). The runners ran from 10 to 55 km a week. A weekly distance of 0 is beyond that, so the 65.79 minutes should not be relied on.
- The value is impossible. Example (invented): the height of a bamboo shoot is modeled by with the number of days since it was first measured. At the model gives cm, and a height cannot be negative. The intercept has no logical interpretation.
When this happens, say so: "the intercept is the predicted value at , but this has no sensible meaning in context because ...". That earns the mark. A reasonable intercept (one that is possible and inside the data) is interpreted like the example above.
5Interpreting
= the square of the correlation coefficient, called the coefficient of determination.
is the proportion of the variation in the response that the linear relationship with the explanatory variable accounts for. The exam word is "explained by".
For the runners, :
About 93.1% of the variation in 10 km race time is explained by the linear relationship with weekly distance.
The other 6.9% is variation the line does not explain: differences between runners with the same weekly distance.
Three things to keep right.
- It is about the response. Variation in race time, not variation in distance.
- It is about the linear relationship. Do not say "93.1% of the runners" or "93.1% of the dots are on the line", and do not say that distance "causes" 93.1% of the time.
- It is not . and . The sentence "93.1% of the variation" belongs to , not to .
6From back to r
is positive whatever the direction, so it cannot tell you the sign of . The sign of is the sign of the slope, since both say whether the pattern rises or falls.
Worked example. A model has and a negative slope. Then .
For the runners, , and the slope is negative, so . Check it against the table in section 3.
7Putting a full answer together
Here is an invented example of the kind of question that appears on the exam. A bakery records the price of a loaf (, in dollars, from 2.00 to 5.00) and the loaves sold in a week (). Technology gives , with .
- Slope: for each additional dollar of price, the predicted number of loaves sold in a week decreases by about 58.
- Intercept: the predicted number of loaves sold at a price of 0 dollars is 412, but 0 dollars is outside the prices in the data and no one sells loaves free, so the intercept has no sensible meaning.
- : about 77% of the variation in weekly loaves sold is explained by the linear relationship with price.
- : the slope is negative, so .
- Prediction at 3.50 dollars: loaves, which is interpolation.
Practice questions
30 questions on this note, from easy to hard. Each one you get right lights a star of this topic's constellation.