Regression and choosing a model for AP Precalculus
Updated
AP Precalculus asks you to build models from data, not just use them. You look at a table, decide which kind of function fits, run a regression in Desmos, and then judge the fit with residuals. The second free-response question, Modeling a Non-Periodic Context, is built around exactly this, and it's on a calculator part of the exam.
This guide covers how to choose a model, the Desmos syntax for each regression, how to read a residual plot, and what a semi-log plot tells you. Every example uses coefficients from a regression that was actually run on the data shown.
Choosing a model from a table
When the inputs are equally spaced, look at how the outputs change from one row to the next. The pattern points to a model type.
- Linear: the differences between outputs are about constant. The output changes by the same amount each step.
- Quadratic: the differences change by about the same amount each step, so the second differences are about constant.
- Cubic: the third differences are about constant.
- Exponential: the ratios of outputs are about constant. The output is multiplied by the same factor each step.
- Logarithmic: multiplying the input by a constant factor adds about the same amount to the output. Look at inputs like .
- Sinusoidal: the outputs rise and fall in a repeating cycle.
Real data won't match a pattern exactly, so check two more things. Shape: does the scatter plot curve, level off, or turn around? A quadratic turns around once, and an exponential never does. Context: a drug in the bloodstream decays toward , so a linear model that goes negative can't be right for long. Population growth by a percent each year suggests exponential.
Running a regression in Desmos
- 1Click the + in the expression list and choose table. Desmos names the columns and .
- 2Type the inputs in the column and the outputs in the column. The points appear on the graph.
- 3On a new line, type the model with a tilde, ~, in place of the equals sign. Desmos finds the best values of the letters and prints them below the line.
- Linear:
- Quadratic:
- Cubic:
- Exponential:
- Logarithmic:
- Sinusoidal:
After the regression runs, the letters are defined everywhere in that graph. Type on a new line and you can evaluate , or graph and click where it crosses . Desmos uses the full unrounded values, so your predictions don't pick up rounding error.
Worked example: an exponential model
A car losing value
(a) The ratios of consecutive values are , then , , , and . Over equal one-year steps, the value is multiplied by about the same factor, which is the pattern of an exponential model.
(b) Enter the table and type . Desmos gives and , so .
(c) Type and then . Desmos shows , so the model predicts a value of about thousand dollars. If you use the rounded values instead, , which is slightly off. The base means the car keeps about of its value each year, so it loses about per year.
Answer: (a) Nearly constant ratios, about to . (b) . (c) About thousand dollars; the car loses about of its value each year.
Reading residuals
A residual is the actual value minus the predicted value: residual . A positive residual means the model predicted too low for that point. A negative one means it predicted too high.
Under a regression line, Desmos lists the residuals as a new variable, , with an option to plot them. Plotting against gives a residual plot. A good model leaves small residuals scattered above and below with no pattern. A curved pattern, such as positive at both ends and negative in the middle, means the model is missing the shape of the data.
Linear or quadratic for stopping distance
The first differences are , so the data aren't linear. The second differences are , close to constant, which already hints at a quadratic.
A linear regression, , gives . Its residuals are about : positive at both ends and negative in the middle.
A quadratic regression, , gives , , and . Its residuals are : all under foot, with no pattern.
The quadratic model is more appropriate. Define and evaluate : about feet. With the rounded coefficients you'd get about , a full foot off, which is why you let Desmos keep the unrounded values.
Answer: Quadratic, because its residuals are small and patternless while the linear residuals form a U shape; about feet at mph.
Semi-log plots
A semi-log plot puts (or ) on the vertical axis and keeps as it is. If the points on a semi-log plot form a line, the data are exponential. Here's why: if , then , which is linear in with slope and intercept .
To go back from a line to an exponential model, undo the log: . So and . For a base-10 log, use in place of . In Desmos, make the new column by typing , then fit .
Views of a new video
(a) The logs are about . They go up by about each day, so the semi-log plot is close to a line. The regression gives and .
(b) . With the unrounded values, and , so . The views grow by about per day.
(c) views. That's extrapolation past the last measured day, and growth this fast can't last, so treat it as a rough estimate.
Answer: (a) . (b) . (c) About views.
Worked example: a logarithmic model
A new worker speeding up
Each input is double the one before, and each doubling adds about the same amount: . Equal factors in the input giving equal changes in the output is the logarithmic pattern. A linear model would need equal changes for equal steps in , and these steps get longer.
Type . Desmos gives and .
boxes per hour. The model keeps rising without bound, which can't be true forever, so it's best used near the measured days.
Answer: ; about boxes per hour after days.
A quick check
From a semi-log line to a model
- A.
- B.
- C.
- D.
Undo the log: , and and . Choice C is the line for , not for . Choice D forgets to exponentiate the intercept.
Answer: A
The algebra behind these models, like turning into , is in the exponential and logarithmic equations guide. For everything else Desmos does on test day, see Desmos on the AP Precalculus exam.
Keep going
Practice on exam-style questions
Intersect Prep has 112 multiple-choice questions for Unit 2, with a full solution for each one. Create a free account to try a full lesson with the calculator. One payment of $29 unlocks the course for 3 months, or $39 for 6 months.
Questions
- How do I know whether data are linear or exponential?
- With equally spaced inputs, check the outputs. About constant differences point to linear, and about constant ratios point to exponential.
- What does a residual plot tell me?
- Whether the model has the right shape. Small residuals scattered above and below zero with no pattern mean the model fits, and a curved pattern means it misses the shape of the data.
- What does a linear pattern on a semi-log plot mean?
- The data are exponential. A line for ln y with slope m and intercept k means y = a times b to the x, where a is e to the k and b is e to the m.
- How do I type an exponential regression in Desmos?
- Put the data in a table, then type y_1 ~ ab^(x_1) on a new line, with the tilde in place of an equals sign. Desmos prints the best values of a and b.