Educerie · AP · Statistics
AP Statistics 5.3
Linear Regression Models
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 a linear regression model uses the explanatory variable x to predict the response, and that the predicted value is written y-hat
- Know the form y-hat = a + bx and what a, b, x and y-hat stand for
- Understand the difference between interpolation and extrapolation and why extrapolation is less reliable
- Know that a line should only be fitted when the scatterplot shows a linear trend
You must be able to
- Calculate a predicted response by substituting a value of x, showing the working and the units
- State whether a prediction is interpolation or extrapolation
- Explain why an extrapolated prediction should be treated with caution
- Define the symbols in a regression equation in context
- Use the word predicted or on average when stating a result
- Spot an impossible predicted value as a sign that the model has been pushed too far
In the exam. Section I gives a fitted equation (and sometimes and ) and asks for a predicted value, often as the second or third question of the regression set of three, or asks which prediction is an extrapolation. In Section II the same equation appears in a free-response question: you substitute a value, write the answer with its units, and say whether the prediction can be trusted.
1The model
A model is a simple description of how a variable behaves, used to predict. The linear regression model is the equation
- is the value of the explanatory variable.
- is the predicted value of the response variable for that . It is not an observed value.
- is the y-intercept of the line: the value of when .
- is the slope of the line: how much changes when goes up by 1.
The exam does not ask you to work out and by hand. Slope, intercept and come from technology, which 5.5 explains.
Notice the hat. The symbol is a value that was observed. The symbol is a value the line gives. They are almost never equal for the same individual, and the gap between them is the subject of 5.4. Writing "" for the line is a common notation error.
Example (invented): an owner records the age of 12 used cars, in years, and the asking price, in thousands of dollars. Figure 1 shows the data, which follow a straight pattern.
Technology gives the line
where is the age of the car in years and is the predicted asking price in thousands of dollars. It is good practice to write what and mean, in the context, next to any equation.
2Calculating a predicted value
To predict, put the value of into the equation. Show the substitution, then the answer with units.
Worked example. Predict the asking price of a car that is 5 years old.
The predicted asking price of a 5-year-old car is about thousand dollars, or about 15,000 dollars. In Figure 1, the point on the line above 5 years is at a height of 15.0.
A second prediction: for a car aged 8 years,
so the predicted asking price is about thousand dollars.
Four habits make the mark safe.
- Substitute into , not . The value you are given goes in the place of . You solve for .
- Show the expression. A bare number may not earn the mark. Write the substituted expression and then the answer.
- Keep the units. The model's is in thousands of dollars here, so say "thousand dollars" or convert.
- Say "predicted". The model does not say what the price is. It says what the price is predicted to be, on average, for a car of that age.
3A prediction is an average, not a promise
The line is a summary of a pattern with scatter. In Figure 1 there are two 5-year-old cars with asking prices above and below the line. The prediction of 15.0 is where the line lies, and no individual car has to sit on it.
Say "predicted" or "on average". Do not say "the car will sell for 15,000 dollars", or "a 5-year-old car is worth exactly 15.0 thousand". The first is a prediction and the second is a claim about every car.
4Interpolation and extrapolation
Interpolation = predicting for an inside the range of -values the line was built from.
Extrapolation = predicting for an outside that range.
In the car data, the ages run from 1 to 9 years. A prediction for 5 or 8 years is interpolation. A prediction for 12 or 15 years is extrapolation.
Figure 2 shows the line extended in both directions. The shaded band is the range of the data. The dashed parts are extrapolation.
Why extrapolation is less reliable. The line was built from cars aged 1 to 9. The data say nothing about what happens outside that range, and the pattern may not continue. The further out you go, the less you can trust the prediction.
Worked example. The model predicts for a 15-year-old car:
A negative price is impossible. The model fits the cars aged 1 to 9, and it breaks down when pushed to age 15. Old cars do not become worth less than nothing: their price levels off or the pattern changes.
A model can also fail within its range of , if the pattern is not linear. That is why the scatterplot comes first, and why 5.4 teaches the residual plot.
Use the line only for -values within the range of the data, and treat a prediction beyond that range with caution.
5Is a line sensible at all?
The linear model should only be fitted to the data if the scatterplot shows a linear trend. If the dots follow a curve, a line gives poor predictions even when is high (5.2, Figure 2(c)). Checks, in order:
- Look at the scatterplot. Does it follow a straight band?
- Look at . Is the linear association strong enough to predict from?
- After fitting, look at the residual plot (5.4). A random scatter supports a line, and a curve in it does not.
Practice questions
30 questions on this note, from easy to hard. Each one you get right lights a star of this topic's constellation.