Building Linear Models
from Data
Learn to fit lines of best fit to real-world data, write equations in \( y = mx + b \) form, and justify why a linear model is the right choice.
What Is a Linear Model?
A linear model is an equation of the form \( y = mx + b \) used to describe the relationship between two variables when the data show a roughly constant rate of change.
Why Build Models from Data?
Real-world data is messy: points rarely fall exactly on a line. A linear model lets us summarize the trend, make predictions, and communicate the relationship between variables clearly.
Scatter Plots Show the Pattern
The Line of Best Fit
The line of best fit (also called the least-squares regression line) minimizes the total squared distance between the line and every data point. Its equation takes the form:
Computing Slope from Data
Interpolation vs. Extrapolation
Residuals: How Good Is the Fit?
A residual is the difference between the observed value and the predicted value:
Justifying a Linear Model
You must explain why a linear model is appropriate. Three key checks:
The Correlation Coefficient \( r \)
The value \( r \) measures the strength and direction of the linear relationship. It ranges from \( -1 \) to \( +1 \):
Step-by-Step: Building the Model
Example 1: Plant Growth
A student measures a plant's height (cm) each week:
| Week \( (x) \) | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| Height \( (y) \) | 3.2 | 5.1 | 6.8 | 9.0 | 10.7 | 12.9 |
Example 2: Taxi Fare
A taxi charges a flat fee plus a per-mile rate. A rider records:
| Miles \( (x) \) | 2 | 5 | 8 | 12 | 15 |
|---|---|---|---|---|---|
| Fare \( (y) \) | $7.50 | $12.00 | $16.80 | $22.50 | $27.20 |
Example 3: Checking Residuals
Using the plant growth model \( \hat{y} = 1.94x + 1.26 \), compute residuals:
| Week | Observed | Predicted | Residual |
|---|---|---|---|
| 1 | 3.2 | 3.20 | 0.00 |
| 2 | 5.1 | 5.14 | −0.04 |
| 3 | 6.8 | 7.08 | −0.28 |
| 4 | 9.0 | 9.02 | −0.02 |
| 5 | 10.7 | 10.96 | −0.26 |
| 6 | 12.9 | 12.90 | 0.00 |
Common Mistakes
Summary: Key Concepts
| Concept | What It Tells You | How to Check |
|---|---|---|
| Slope \( m \) | Rate of change per unit of \( x \) | \( \frac{y_2 - y_1}{x_2 - x_1} \) |
| Intercept \( b \) | Predicted \( y \) when \( x = 0 \) | \( b = y_1 - m \cdot x_1 \) |
| Residual | How far a point is from the line | \( y - \hat{y} \) |
| \( r \) value | Strength and direction of trend | Calculator or formula |
| Justification | Is a linear model appropriate? | Scatter shape + residuals + \( r \) |
Question 1 of 5
A data set has points \( (3, 14) \) and \( (9, 32) \). What is the slope of the line through these points?
Question 2 of 5
A linear model gives \( \hat{y} = 2.5x + 10 \). When \( x = 4 \), the observed value is \( y = 22 \). What is the residual?
Question 3 of 5
Which of the following best justifies using a linear model for a data set?
Question 4 of 5
In the model \( \hat{y} = 1.52x + 4.46 \) for taxi fares (where \( x \) is miles), what does the \( y \)-intercept represent?
Question 5 of 5
A residual plot shows a clear U-shaped pattern. What does this indicate?