Making Predictions from Data
Use a regression line to predict values, work backwards to a target, and judge when a prediction can be trusted.
Definition
- **Predict from **: substitute the -value and calculate .
- **Find for a target **: set equal to the target and solve: .
- Interpolation: is inside the range of the data. The prediction is usually reasonable.
- Extrapolation: is outside the range of the data. The pattern may not continue, so the prediction is risky.
Try it now
Worked Examples
Check where the x-value lies
Substitute x = 6.5 into the equation
Multiply
Add the intercept
Answer: The predicted score is , so about points. Because hours is inside the data, this is interpolation and the prediction is reasonable.
Common Mistakes
Putting the target y-value in place of x: for a target score of , calculating
Why it's wrong: is a score, so it is a -value. Substituting it for answers a different question (the score after 80 hours of study).
Correct: Set the equation equal to the target and solve for : , so .
Trusting extrapolation: predicting points for hours of study
Why it's wrong: The pattern was only observed from 1 to 8 hours. Outside that range it can change, and here the score cannot even go above 100.
Correct: Always check the data range first. Mark predictions outside it as extrapolation and treat them with caution.
Rounding without thinking about the situation: reporting points as exact, or rounding hours down to
Why it's wrong: A prediction is an estimate, so extra decimals suggest more precision than it has. Rounding down a target can leave you short (5 hours predicts only 77 points).
Correct: Round to the precision of the data, and round up when you have to reach a goal or cover everyone (time, chairs, buses).
Treating every prediction as equally reliable
Why it's wrong: A line can always be calculated, even for scattered data. With the actual values can be far from .
Correct: Look at the scatter plot or first: close to 1 means a reliable prediction, close to 0 means only a rough guess.
Interactive Visual
Function graph
Tap or hover over the graph to read off values.
- Predicted score ŷ = 5x + 52 = 84.5
- Hours outside the data range (0 = interpolation) = 0 h
Scatter Plot
Strong correlation: hours studied and test score
ŷ = 5x + 52
r = 0.992 · strong positive correlation
Tap a point to see its coordinates.
Scatter Plot
Weak correlation: hours of sleep and test score
ŷ = 2x + 59
r = 0.209 · weak positive correlation
Tap a point to see its coordinates.
Interactive Sandbox
Expression Calculator
Try these:
History
No calculations yet
Practice Problems
18 problemsWhy It Matters
- Planning: A school fair predicts how many visitors to expect, so it knows how many chairs to set out.
- Health: Doctors compare a child's height with growth models to see whether growth is on track.
- Delivery apps: Apps estimate how long your order will take from the distance to the restaurant.
- Batteries: Phones estimate how many hours of battery are left from how fast it is draining.
Real World Applications
Child Growth Charts
Doctors compare a child's height with growth models. A simple model for ages 2 to 10 is $\hat{y} = 6x + 77$, where $x$ is age in years and $\hat{y}$ is height in cm. The model only works for those ages: for an adult of 40 it would predict $317$ cm.
Example:
At age 5 the model predicts cm.
A growth model for ages 2 to 10 is (height in cm, age in years).
What height does the model predict for an 8-year-old?
Step 1: Write the mathematical expression
Substitute :
Delivery Time Estimates
Food delivery apps fit lines to past orders to estimate delivery times. One app found $\hat{y} = 3x + 8$, where $x$ is the distance in km (orders from 1 to 12 km) and $\hat{y}$ is the time in minutes.
Example:
For a restaurant 5 km away the app predicts minutes.
The delivery model is (minutes, distance in km, data from 1 to 12 km). The app wants to promise delivery in 35 minutes.
Up to what distance in km can the app make that promise?
Step 1: Write the mathematical expression
Solve for :
Phone Battery Forecasts
Phones estimate the remaining battery from how fast it is draining. Measurements while streaming video gave $\hat{y} = 100 - 8x$, where $x$ is hours of video (data from 0 to 10 hours) and $\hat{y}$ is the battery level in percent.
Example:
After 6 hours of video the model predicts .
The battery model is (percent, in hours, data from 0 to 10 hours). Someone asks what the battery will show after 15 hours of video.
What value does the model predict for 15 hours?
Step 1: Write the mathematical expression
Substitute :
Key Takeaways
- 1To predict , substitute into ; is a predicted value, not a measured one
- 2To find the for a target , set equal to the target and solve:
- 3Interpolation predicts inside the data range and is usually reasonable
- 4Extrapolation predicts outside the data range and is risky: it can even give impossible values
- 5Round predictions to a sensible precision, and round up when you must reach a goal or cover everyone
- 6Predictions are reliable when is close to 1 and only rough guesses when is close to 0
Frequently Asked Questions
Glossary
- Predicted value
- The value of that the regression line gives for a chosen
- Data range
- The interval from the smallest to the largest -value in the data
- Interpolation
- Predicting for an -value inside the data range
- Extrapolation
- Predicting for an -value outside the data range; risky because the pattern may change
- Explanatory variable
- The variable used to make the prediction (for example hours studied)
- Response variable
- The variable being predicted (for example the test score)
Formula Card
Predict y from x
Substitute the x-value and calculate
Find x for a target y
Subtract the intercept, then divide by the slope
Interpolation check
If x is inside the data range, the prediction is interpolation; otherwise it is extrapolation