Linear Regression Models
Use a straight-line model to turn an explanatory value into a predicted response. Learn to substitute correctly, explain the answer in context, and spot when a prediction reaches beyond the data.
By the end of this lesson, you should be able to:
- Identify the explanatory variable, response variable and predicted response in a model.
- Calculate a prediction from a given linear regression equation, with the correct units.
- Distinguish interpolation from extrapolation and explain the limits of a prediction.
Before you start: Review scatterplots and correlation. You should be comfortable substituting a number into a linear equation.
First time learning this? Follow the delivery-time example and the prediction graph. Then work through the four examples.
Here to revise? Review the prediction checklist, then attempt the practice questions before opening the solutions.
The concept in 60 seconds
A linear regression model uses an explanatory variable to predict a response with a straight-line equation. The general form is:
is the explanatory value you supply. , read “y-hat,” is the response the model predicts. The coefficient is the intercept and is the slope.
Prediction is a model estimate. It is not a guaranteed result for an individual. An observed response is written ; the predicted response is written .
For example, suppose delivery time in minutes is predicted from distance in kilometres by . A distance of gives . The model predicts a delivery time of minutes.
Quick check: what goes into the equation?
The explanatory value goes in for . You calculate , the predicted response. You do not substitute an already observed response for .
A real situation: predict delivery time
A local delivery company records distance and total delivery time for deliveries on similar routes. Distance is measured in kilometres and time in minutes. These are invented teaching data.
| Delivery ID | Distance (km) | Observed time (min) |
|---|---|---|
| A | ||
| B | ||
| C | ||
| D | ||
| E | ||
| F | ||
| G | ||
| H | ||
| I |
Software supplies the fitted model below. For now, use the given equation; how least squares determines the coefficients is developed in Topic 5.5.
Dots are observed deliveries. The square marks a model prediction at a new distance; dashed guides connect the input to its predicted response. All data are invented.
Question: What time does the model predict for a delivery travelling ?
Answer in context: For a delivery travelling kilometres on a comparable route, the model predicts a total time of about minutes. It does not promise that the delivery will take exactly that long.
The recorded distances span . Since lies inside that interval, this prediction is interpolation—even though there is no recorded delivery at exactly kilometres.
Why are the dots not all on the fitted line?
The dots show actual observations; the line shows model predictions. Traffic, loading and other factors create variability. For delivery C, the observed time is minutes at kilometres, while the model predicts minutes. Measuring the difference between observation and prediction is the focus of Topic 5.4.
Key ideas and notation
Explanatory value:
The input used to make the prediction. In the delivery model, it is distance in kilometres.
Observed response:
The response actually recorded for an individual. A dot on the scatterplot represents an observed pair.
Predicted response:
The output from the fitted equation at a specified . A point on the regression line represents a model prediction.
Intercept:
The predicted response when . Its units are the response units. Whether it has a useful real-world meaning depends on the context.
Slope:
The change in the predicted response for a one-unit increase in the explanatory value. Its units are response units per explanatory unit.
Observed range
The interval from the smallest to the largest explanatory value used to fit the model. Check it before trusting a prediction.
Watch the hat: is measured; is calculated from the model. Writing the hat helps keep evidence and prediction separate.
Make a prediction in four steps
- Identify the variables and units. Confirm which measurement is the input and which is being predicted.
- Choose the explanatory value. Express it in the same units used in the model.
- Substitute and calculate. Multiply before adding, keep the sign of the coefficient, and retain useful precision.
- Interpret and check the range. State the predicted response with units and assess whether the input lies within the observed interval.
Apply the method to the delivery model
The input is distance in kilometres and the output is predicted time in minutes. For :
So the model predicts about minutes. The input lies between and kilometres, making this interpolation.
Keep the original units
If the distance is given as , convert it to before using this equation. Substituting into a model built for kilometres would produce an incorrect prediction.
Round at the end
Use the supplied coefficients as given. If software provides more digits than the written equation, use that precision unless the question specifies the rounded model. Write “approximately” when appropriate; a decimal output does not make the prediction exact.
Read the line and its units
In , the intercept is minutes and the slope is minutes per kilometre. Each extra kilometre corresponds to an increase of minutes in the predicted time.
The intercept gives the model’s prediction at : . But zero kilometres is outside the recorded interval and a zero-distance delivery may not make sense in this setting. Treat that intercept as part of the equation; do not claim the data establish an actual zero-distance delivery time.
Negative slopes work the same way
Suppose an invented battery study provides , where is hours of use and is predicted remaining charge as a percentage. The observed times span .
The line is the supplied battery model over the observed time interval. The square marks the prediction after four hours; no individual measurements are shown.
At hours, the model predicts remaining charge. A negative slope means predictions decrease as the input increases; it does not mean the predicted response must be negative.
This section helps you read a supplie[Truncated]