01 / 21

Fitting Models
to Data

Learn to select the best regression model for a dataset, use technology to find the equation, and interpret parameters in real-world context.

Math 3

What Does It Mean to Fit a Model?

Fitting a model means finding a mathematical equation that best describes the relationship between variables in a dataset. We use technology: graphing calculators, Desmos, or spreadsheets: to compute the equation that minimizes the overall error.

Types of Regression Models

Linear
\( y = ax + b \)
Constant rate of change
Quadratic
\( y = ax^2 + bx + c \)
One turn (max or min)
Exponential
\( y = a \cdot b^x \)
Multiplicative growth/decay

Visualizing Different Fits

Linear Quadratic Exponential

Each model type produces a different curve shape. The scatter plot's pattern tells you which to choose.

The Correlation Coefficient \( r \) and \( r^2 \)

After fitting a model, technology reports \( r \) (for linear) or \( r^2 \) (for all types). These tell you how well the model matches the data.

\( r \) value
Ranges from \( -1 \) to \( 1 \). Measures direction and strength of a linear relationship.
\( r^2 \) value
Ranges from \( 0 \) to \( 1 \). The proportion of variance in \( y \) explained by the model.

Understanding Residuals

A residual is the difference between an observed value and the value predicted by the model:

x y Residual Observed

A good fit has residuals that are small and randomly scattered (no pattern). If residuals show a curve, try a different model type.

Interpolation vs Extrapolation

Interpolation
Predicting within the range of the data. Generally reliable.
Extrapolation
Predicting beyond the range of the data. Less reliable: the real-world trend may change.
Data range (interpolation) Extrapolation

How to Fit a Model: Step by Step

1
Plot the data as a scatter plot. Look at the overall shape.
2
Choose a model type: linear, quadratic, or exponential based on the shape.
3
Run the regression using technology (calculator, Desmos, etc.).
4
Check \( r^2 \) and the residual plot to confirm the fit is good.
5
Interpret the parameters (\( a \), \( b \), \( c \)) in the context of the problem.

Interpreting Parameters in Context

The numbers in your regression equation have real-world meaning. You must connect them back to the problem scenario.

Linear \( y = ax + b \)
\( a \) = rate of change per unit of \( x \)
\( b \) = starting value when \( x = 0 \)
Quadratic \( y = ax^2 + bx + c \)
\( a \) = direction and width of parabola
\( c \) = initial value when \( x = 0 \)
Exponential \( y = a \cdot b^x \)
\( a \) = initial amount
\( b \) = growth/decay factor per unit of \( x \)

Example 1: Linear Regression

A store tracks monthly sales (\( y \), in thousands) over months since opening (\( x \)). Technology gives:

Months since opening Sales ($k) 2 5 8 11 14 15 25 35 45

Example 2: Quadratic Regression

A ball is launched upward. Height (\( y \), in feet) is recorded at various times (\( x \), in seconds). Technology gives:

Time (seconds) Height (ft) 0 0.5 1.0 1.5 2.0 2.5 0 15 30 45 Max at x = 1.5

Example 3: Exponential Regression

A population of bacteria (\( y \), in thousands) is measured every hour (\( x \)). Technology gives:

Hours Bacteria (k) 1 2 3 4 5 6

Constraints and Domain Limits

A regression model is only valid under certain constraints. Always consider the real-world context when interpreting or using your model.

1
Domain constraint: Your model is only trustworthy for \( x \)-values within (or near) the original data range.
2
Physical constraints: Negative time, negative population, or negative distance may be mathematically possible but physically meaningless.
3
Growth limits: Exponential models cannot grow forever. Real populations hit carrying capacities. State when the model breaks down.

When to Switch Models

If your first regression choice has a low \( r^2 \) or a patterned residual plot, try a different model type.

Good: Random Residuals 0 Bad: Curved Pattern 0

Common Mistakes

✕ Choosing Wrong Model
Using linear regression on data that curves. Always plot first and check residuals.
✕ Over-Extrapolating
Predicting far beyond the data range and treating it as reliable. State domain limits.
✕ Ignoring Context
Reporting \( a = 2.3 \) without saying what it means: "sales increase by $2,300/month."

Model Comparison Summary

Feature Linear Quadratic Exponential
Equation \( y = ax + b \) \( y = ax^2 + bx + c \) \( y = a \cdot b^x \)
Shape Straight line Parabola (U or ∩) Curve (growth/decay)
Rate of Change Constant Changes linearly Multiplicative
Key Parameter \( a \) = slope \( a \) = curvature direction \( b \) = growth factor
Best For Steady trends Projectiles, arcs Populations, finance

Question 1 of 5

A regression model gives \( y = 3.2x + 18 \) for the relationship between weeks (\( x \)) and total items sold (\( y \)). What does the 3.2 represent?

Question 2 of 5

A researcher fits an exponential model \( y = 50 \cdot 0.85^x \) to data about a medicine's concentration (\( y \) mg) over hours (\( x \)). What does \( b = 0.85 \) tell us?

Question 3 of 5

You run a linear regression on a dataset and get \( r^2 = 0.42 \). The residual plot shows a clear U-shaped pattern. What should you do?

Question 4 of 5

A quadratic model \( y = -4.9x^2 + 20x + 1.5 \) describes the height (meters) of a kicked ball over time (seconds). Data was collected for \( 0 \leq x \leq 4 \). Which prediction is most reliable?

Question 5 of 5

Two models are fit to the same dataset. Model A (linear) has \( r^2 = 0.89 \). Model B (exponential) has \( r^2 = 0.97 \). Both have randomly scattered residuals. Which model should you choose and why?