01 / 21

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.

Algebra 1

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.

\( m \) : Slope
The rate of change: how much \( y \) increases (or decreases) for each unit increase in \( x \).
\( b \) : \( y \)-intercept
The predicted value of \( y \) when \( x = 0 \): the starting point of the model.

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.

Summarize
Replace dozens of data points with one simple equation.
Predict
Estimate \( y \) for an \( x \)-value you haven't observed yet.
Justify
Explain why a linear model fits: constant rate, scatter pattern, residuals.

Scatter Plots Show the Pattern

Hours Studied Test Score 1 3 5 7 9 50 60 70 80 Best Fit

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

\( (2, 55) \)
\( (8, 75) \)
\( \text{Rise} = 20 \)
\( \text{Run} = 6 \)

Interpolation vs. Extrapolation

Interpolation
Predicting within the range of observed data. Generally reliable if the model fits well.
Extrapolation
Predicting beyond the range of observed data. Risky: the trend may not continue.

Residuals: How Good Is the Fit?

A residual is the difference between the observed value and the predicted value:

\( + \)
\( - \)
Above line Below line

Justifying a Linear Model

You must explain why a linear model is appropriate. Three key checks:

1
Scatter plot shape: the points follow a roughly straight pattern with no obvious curves.
2
Residual plot: residuals are randomly scattered around zero with no visible pattern (no U-shape or fan).
3
Correlation coefficient \( r \): a value close to \( \pm 1 \) indicates a strong linear association.

The Correlation Coefficient \( r \)

The value \( r \) measures the strength and direction of the linear relationship. It ranges from \( -1 \) to \( +1 \):

-1 Strong neg. 0 No linear +1 Strong pos.
\( |r| > 0.8 \)
Strong linear relationship: a linear model is well justified.
\( 0.5 < |r| < 0.8 \)
Moderate: linear model may work, check residuals carefully.
\( |r| < 0.5 \)
Weak: a linear model likely does not fit well.

Step-by-Step: Building the Model

1
Plot the data on a scatter plot. Look for a linear pattern.
2
Draw or compute the line of best fit. Use technology or pick two representative points.
3
Write the equation in slope-intercept form: \( \hat{y} = mx + b \).
4
Interpret \( m \) and \( b \) in context: what do slope and intercept mean for the situation?
5
Justify the model: check the scatter plot shape, residual plot, and \( r \) value.

Example 1: Plant Growth

A student measures a plant's height (cm) each week:

Week \( (x) \) 123456
Height \( (y) \) 3.25.16.89.010.712.9

Example 2: Taxi Fare

A taxi charges a flat fee plus a per-mile rate. A rider records:

Miles \( (x) \) 2581215
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
13.23.200.00
25.15.14−0.04
36.87.08−0.28
49.09.02−0.02
510.710.96−0.26
612.912.900.00

Common Mistakes

✕ Forcing a Line on Curves
If the scatter plot curves, a linear model is the wrong choice. Always check the shape first.
✕ Swapping \( x \) and \( y \)
Slope is \( \frac{\Delta y}{\Delta x} \), not the reverse. Mixing them up inverts your model entirely.
✕ Extrapolating Too Far
A model valid for \( x = 1 \) to \( 10 \) should not be used at \( x = 100 \). The trend may not hold.

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?