All AP Courses AP StatisticsAP Stats

Unit 5 · Topic 5.3 · about 20 minutes

AP Statistics 5.3: Linear Regression Models

Use a linear regression model to calculate a predicted response, and judge whether that prediction can be trusted.

Unit 5: 10 to 20% of the multiple-choice section

What you'll be able to do

  • Calculate a predicted response value using a linear regression model.

Key vocabulary

TermWhat it meansThe exam trap
Linear regression modelA linear equation, y^=a+bx, that uses the explanatory variable x to predict the response variable y, where a is the y-intercept and b is the slope.Fitting one to curved data, like the typing speeds, gives a line that misses in the same direction over whole stretches of the data.
Predicted value y^The response value the model gives for a value of x. Plain y is a value that was actually observed.Writing y where y^ belongs turns a prediction into a claim about an observed value.
InterpolationPredicting the response for an x-value inside the interval of x-values used to build the model.Being close to the edge does not make it extrapolation: 1,150 square feet is still inside data that run from 1,100 to 3,200.
ExtrapolationPredicting the response for an x-value beyond the interval of x-values used to build the model. The further out, the less reliable the prediction.Even with r=−0.96, the sedan line says a 20-year-old car is worth −4.80 thousand dollars, because a strong fit inside the data says nothing outside it.

Predict first

A line fits the 14 used sedans from 5.1 Graphical Representations Between Two Quantitative Variables very well: their ages run from 1 to 10 years, and r=−0.96. A neighbor wants to use the same line to price her own sedan of that model, which is 20 years old. How much should she trust the prediction?

A line that predicts

When a scatterplot shows a linear form, you can summarize the relationship with a linear regression model: an equation that uses the explanatory variable x to predict the response variable y.

y^=a+bx

Here a is the y-intercept, b is the slope, and x is a value of the explanatory variable. What a and b mean in context is the subject of 5.5 Least-Squares Regression.

The hat on y^ (say "y-hat") marks a predicted value. Plain y is a value that was actually observed. Keep the two apart. The model gives a prediction, and real cars land above it or below it.

The model only makes sense when the form looks linear. A straight line fit to curved data, like the typing speeds in 5.1 Graphical Representations Between Two Quantitative Variables, will miss in the same direction over whole stretches of the data.

The sedans with the model y^=26.38−1.559x

10152025Asking price (thousands of dollars)246810Age (years)

Price is in thousands of dollars, so a predicted value of 17.03 means about 17,030 dollars.

Making a prediction

To predict, substitute a value of x and calculate. For a 6-year-old sedan:

y^=26.38−1.559(6)=17.03

The model predicts an asking price of about 17,030 dollars. Two of the sedans in the data are 6 years old, listed at 16,800 and 17,800 dollars. Neither matches the prediction, and the model never promised that it would. 5.4 Residuals measures how far each real car lands from the line.

Inside the data or outside it

The 14 sedans are 1 to 10 years old. A prediction for an age inside that interval, like 6 years, is interpolation. A prediction for an age outside it, like 20 years, is extrapolation.

Interpolation has data on both sides of it. Extrapolation assumes the straight-line pattern keeps going where nobody collected any data, and patterns often change. Cars lose value quickly at first and more slowly later, so a line fit to younger cars drops below zero long before real prices do. The model hits zero at about 17 years.

The further you extrapolate, the less reliable the prediction. A 12-year-old sedan is a small stretch past the data. A 20-year-old sedan is a leap.

Chirp rate and temperature on 16 summer nights

406080Temperature (degrees Fahrenheit)50100150200Chirps per minute

The data stop at 82 chirps per minute. Everything to the left of that is the line continuing on its own, with no nights to check it against.

Worked examplePredicting temperature from cricket chirps

On 16 summer nights, a student counted how many times a snowy tree cricket chirped in one minute and recorded the temperature. Chirp rates ran from 82 to 184 per minute. The regression line is y^=40.73+0.2447x, where x is chirps per minute and y^ is the predicted temperature in degrees Fahrenheit. (a) Predict the temperature on a night with 150 chirps per minute. (b) A cricket in a cold garage chirps 30 times per minute. What does the model predict, and should you trust it?

  1. Identify x. The model takes chirps per minute and returns a temperature, so 150 and 30 are values of x.

  2. (a) Substitute. y^=40.73+0.2447(150)=77.4. The model predicts about 77.4 degrees. Since 150 is between 82 and 184, this is interpolation.

  3. (b) Substitute. y^=40.73+0.2447(30)=48.1 degrees. But 30 chirps per minute is far below anything in the data, so this is extrapolation. The student never recorded a night that cold and has no evidence the line still holds there.

  4. Compare. Trust (a) far more than (b). The arithmetic is equally easy in both; the evidence behind it is not.

Answer.

(a) About 77.4 degrees, an interpolation. (b) About 48.1 degrees, but 30 chirps per minute is well outside 82 to 184, so this extrapolation is much less reliable.

Lab

Regression Playground

Place about eight points in a rising band across the left half of the plot and note where the line sits at the far right edge. Then add three points at the far right that level off instead of rising. The line swings to follow them, and the earlier extrapolation turns out to be well off.

Open the full Regression Playground lab

Check your understanding

1

A pet store models a hamster's weight (grams) from its age (weeks), using hamsters 3 to 12 weeks old: y^=22.5+9.4x. What weight does the model predict for an 8-week-old hamster? Give your answer in grams.

2

A model that predicts a house's sale price from its floor area was built from 60 houses with floor areas between 1,100 and 3,200 square feet. For which house is the prediction an extrapolation?

3

A model predicts the temperature (degrees Fahrenheit) from the number of cricket chirps per minute, x: y^=40.73+0.2447x. What does y^ stand for?

4

A pediatrician's model predicts a child's height (inches) from age (years), using children aged 2 to 10: y^=31.6+2.5x. A parent substitutes her own age, 40. Which statement is correct?

5

A linear regression model predicts nighttime temperature from cricket chirps per minute. The data used to fit it covered chirp rates from 82 to 184 per minute, but no night had between 125 and 130 chirps per minute. Using the model to predict the temperature at 127 chirps per minute is

Exam strategy for this topic

  • Section I, Multiple Choice: 42 questions in 90 minutes.
  • Section II, Free Response: 4 questions in 90 minutes.
  • A graphing calculator with statistical capabilities is expected on both sections.

Questions students ask

What does the hat on y^ mean?

It marks a predicted value, read 'y-hat'. Plain y is what actually happened, and real values land above or below the prediction.

Is a prediction inside the data always right?

No, it is the model's prediction, not a promise. Two 6-year-old sedans were listed at 16,800 and 17,800 dollars, while the model predicted about 17,030 for a 6-year-old.

How far outside the data is too far?

There is no fixed cutoff. The further you extrapolate, the less reliable the prediction. With sedans aged 1 to 10 years, a 12-year-old car is a small stretch and a 20-year-old car is a leap.

Why did the sedan model predict a negative price?

The line keeps falling at the same rate forever and reaches zero at about 17 years. Real cars lose value quickly at first and more slowly later, so the straight-line pattern stops matching real prices well past the data.

Can I predict for an x-value that no individual in the data had?

Yes, that is what a model is for. No night had 127 chirps per minute, but 127 lies between 82 and 184, so the prediction is interpolation.

Course alignment, for teachers

AP Statistics topic 5.3, Unit 5: Regression Analysis.

  • Skill 3.B: Calculate summary statistics, relative positions of points within a distribution, and predicted responses.