Fiveable

📊AP Statistics Unit 2 Review

QR code for AP Statistics practice questions

2.7 Residuals

📊AP Statistics
Unit 2 Review

2.7 Residuals

Written by the Fiveable Content Team • Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examWritten by the Fiveable Content Team • Last updated September 2025
📊AP Statistics
Unit & Topic Study Guides
Pep mascot

When evaluating the effectiveness of a linear regression model, we use residuals to do this. 

What is a residual, then? 

Residuals are a measure of how well a linear regression model fits the data. They are the differences between the observed values of the response variable (y) and the predicted values (ŷ) from the model, so y - ŷ.

In a linear regression model, the goal is to find the line of best fit that minimizes the sum of the squared residuals. This is known as the least squares criterion. The residuals for each point represent the vertical distance between the point and the line of best fit. If a point has a small residual, it means that the model is predicting the value of the response variable well for that point. On the other hand, if a point has a large residual, it means that the model is not predicting the value of the response variable well for that point.

Here's another way to think about it, this time in terms of having "positive" and "negative" residuals: if we have a positive residual, then the actual value is greater than the predicted value and we say that the model underestimates the true value by a certain amount. Likewise, if we have a negative residual, then the actual value is less than the predicted value and we say that the model overestimates the true value by a certain amount.

Residual Plots

residual plot is a graph that plots the residuals (the differences between the observed values and the predicted values) on the vertical axis and the predictor or explanatory variable on the horizontal axis. I

If the residual plot for a linear regression model exhibits apparent randomness, it can be taken as evidence that the relationship between the predictor and response variables is linear. In other words, it suggests that the model is capturing the underlying relationship in the data correctly. 

"Apparent randomness" means that the residuals are randomly dispersed around the horizontal axis, as it indicates that the model is fitting the data well and that the residuals are not systematically related to the predictor variable.

Here are two examples of scatterplots with linear regression models (and also their residual plots).

Pep mascot
more resources to help you study

Example 1

In the example below, we can see that our linear regression model fits our data fairly well (scatterplot on left). Therefore, the residual plot (on right) seems to show no apparent pattern. Our red points seem equally scattered about the red line at 0.

Courtesy of Starnes, Daren S. and Tabor, Josh. The Practice of Statistics—For the AP Exam, 5th Edition. Cengage Publishing.

Example 2

In this data, we can clearly see that our data follows a curved pattern, not the linear model pictured (scatterplot on left). Therefore, our residual plot (on right) shows an apparent curved pattern. We will learn more about these types of models in Unit 2.9 and how to adjust these to create a linear model.

Courtesy of Starnes, Daren S. and Tabor, Josh. The Practice of Statistics—For the AP Exam, 5th Edition. Cengage Publishing.

Good or Bad?

How do we tell whether a model is good? Look at the residual plot. For a good model, the residuals should be randomly scattered and have no clear pattern like with the first set above. In the second set, there is a distinct curve in the residual plot, meaning that a linear regression model is not appropriate to the scatterplot and a nonlinear model would be best.

Calculating Residuals

In order to calculate a residual for a given data point, we need the LSRL for that data set and the given data point.

We will first calculate the predicted value using the LSRL. Then, we subtract the predicted value from the actual value in the given data point. In other words, our formula is Residual = (Actual)-(Predicted).

Example 1

A LSRL model for the predicted amount of Lucky Charms eaten in accordance with one's age in years is given by the equation below:

ŷ=150.5x-2.34

A 50 year old from our data set is said to have eaten 7,500 lucky charms in his life! Wow! I hope he found the gold at the end of the rainbow! Calculate the residual for his number.

ŷ = 150.5(50) - 2.34

ŷ = 7522.66

Residual is 7500 - 7522.66= -22.66.

Keep in mind that sometimes you may be asked to calculate one's actual data point (or predicted data point) when given the residual. This would require the same formula, but working backwards.

Example 2

A researcher is studying the relationship between the number of hours spent studying for an exam and the score received on the exam. She collects data from 50 students and fits a linear regression model to the data. The residual plot for the model is shown below:

a) Describe the pattern, if any, in the residual plot.

b) Explain what the pattern in the residual plot suggests about the fit of the model.

c) If the model is not fitting the data well, suggest one potential reason why this may be the case.

d) Assuming that the model is not fitting the data well, propose one potential solution to improve the fit of the model.

e) Explain how the solution you proposed in part (d) would address the issue with the model.

Answers

a) The residual plot exhibits a curved pattern.

b) The pattern in the residual plot suggests that the fit of the model is not good. The residuals are not randomly dispersed around the horizontal axis, indicating that there is a systematic relationship between the predictor and response variables that is not being captured by the model.

c) One potential reason why the model may not be fitting the data well is that the relationship between the number of hours spent studying and the exam score is not linear. There may be some other underlying relationship between the variables that is not being captured by the model.

We'll learn more about d) and e) in future sections!

d) One potential solution to improve the fit of the model would be to transform the data in some way, such as by taking the logarithm of the number of hours spent studying or the exam score. 

e) The solution proposed in part (d) would address the issue with the model by allowing the relationship between the predictor and response variables to be more accurately captured. A transformation may be able to uncover a more appropriate functional form for the relationship between the variables, leading to a better fit of the model.

🎥Watch: AP Stats - Least Squares Regression Lines

Vocabulary

The following words are mentioned explicitly in the College Board Course and Exam Description for this topic.

TermDefinition
actual valueThe observed or measured response value in a dataset, denoted as y.
bivariate dataData involving two variables, typically represented as ordered pairs (x, y) to examine the relationship between them.
form of associationThe pattern or type of relationship between two variables, such as linear, curved, or no relationship.
linear modelA mathematical representation of the linear relationship between two variables.
predicted valueThe estimated response value obtained from a regression model, denoted as ŷ.
randomness in residualsThe absence of a clear pattern in a residual plot, indicating that a linear model is appropriate for the data.
residualThe difference between the actual observed value and the predicted value in a regression model, calculated as residual = y - ŷ.
residual plotA scatter plot that displays residuals on the vertical axis versus either the explanatory variable values or predicted response values on the horizontal axis, used to assess the fit of a regression model.

Frequently Asked Questions

How do I calculate residuals using the formula y - ŷ?

Take each observed y and subtract its predicted ŷ from your regression line: residual = y − ŷ. Steps: (1) plug the x into the LSRL ŷ = a + b x to get ŷ, (2) compute residual = actual y − ŷ, (3) keep sign: positive residual means the point lies above the line (y higher than predicted), negative means below. Example: if ŷ = 12.3 and y = 15.0, residual = 15.0 − 12.3 = 2.7. On the AP, you’ll use residuals to make a residual plot (residuals vs x or vs ŷ) to check linearity and constant variance—random scatter supports a linear model (CED DAT-1.E and DAT-1.F). Remember the mean of residuals for an LSRL is 0. Want more practice and review? See the Topic 2.7 study guide (https://library.fiveable.me/ap-statistics/unit-2/residuals/study-guide/zdTJQZw0UVGswyK6kkEF) and hit the AP practice questions (https://library.fiveable.me/practice/ap-statistics).

What's the difference between actual value and predicted value in residuals?

The actual value is the observed response y (what you measured). The predicted value ŷ is what the regression model (least squares line) estimates for that x. A residual = y − ŷ measures that difference: positive residual → the model underpredicted (point lies above the line); negative residual → the model overpredicted (point lies below the line). Residual plots (residuals vs x or vs ŷ) help you check model assumptions: if residuals show random scatter (mean ~0) the linear form is appropriate; patterns or fan shapes indicate nonlinearity or heteroscedasticity. On the AP exam you may need to compute and interpret residuals (DAT-1.E: residual = y − ŷ) and use residual plots to judge linearity (DAT-1.F). For a focused review, check the Topic 2.7 study guide (https://library.fiveable.me/ap-statistics/unit-2/residuals/study-guide/zdTJQZw0UVGswyK6kkEF) and practice problems (https://library.fiveable.me/practice/ap-statistics).

When do I use residual plots vs regular scatter plots?

Use a regular scatterplot when you want to describe the raw relationship between two quantitative variables—direction, form, strength, and any obvious outliers. Use a residual plot when you’ve fit a model (often the least-squares line) and need to check whether that model is appropriate. Quick checklist (AP style): - Scatterplot: shows y vs x; good for seeing linear vs nonlinear association and estimating correlation (DAT-1.H, DAT-1.F). - Residual plot: plot residual = y − ŷ versus x (or versus ŷ). You’re looking for random scatter centered near 0. If residuals show no pattern, that supports a linear model (DAT-1.E.2, DAT-1.F.1). If you see curvature (pattern) or fan shape (heteroscedasticity) the linear model is inappropriate (DAT-1.F.2). Also use residual plots to spot outliers/influential points. Remember residuals should average about 0; any systematic pattern means revise the model. For the CED-aligned guide on residuals see the Topic 2.7 study guide (https://library.fiveable.me/ap-statistics/unit-2/residuals/study-guide/zdTJQZw0UVGswyK6kkEF). For more review and practice, check the Unit 2 overview (https://library.fiveable.me/ap-statistics/unit-2) and lots of practice problems (https://library.fiveable.me/practice/ap-statistics).

Can someone explain step by step how to make a residual plot?

Step-by-step: 1) Fit the least-squares regression line (LSRL) for your data (ŷ = a + bx). Use your calculator or software (AP exam allows a graphing calculator). 2) For each point, compute the residual: residual = y − ŷ. (CED DAT-1.E.1) 3) Make a scatterplot with the explanatory variable x (or the predicted values ŷ) on the horizontal axis and the residuals on the vertical axis. (CED DAT-1.E.2) 4) Add a horizontal line at residual = 0. Check the mean of residuals ≈ 0 (a property of LSRL). 5) Interpret: random scatter around 0 supports a linear model (DAT-1.F.1). Patterns (curves) show nonlinearity; funnel shapes show heteroscedasticity; isolated big residuals are outliers/influential. (DAT-1.F.2 + keywords) For quick review, see the Topic 2.7 study guide (Fiveable) (https://library.fiveable.me/ap-statistics/unit-2/residuals/study-guide/zdTJQZw0UVGswyK6kkEF). For more practice, try problems at (https://library.fiveable.me/practice/ap-statistics).

I don't understand what ŷ means in the residual formula - is that y-hat?

Yes—ŷ is “y-hat,” the predicted y from your model. Residual = y − ŷ (actual minus predicted). If your least-squares line is ŷ = a + b x, you plug in the x to get ŷ for that case, then subtract from the observed y to get the residual. Residuals tell you how far each point is from the model: positive residual → model underestimates (point above line); negative residual → model overestimates (point below line). On the AP CED, residuals and residual plots (DAT-1.E, DAT-1.F) are used to check model fit—you want random scatter (no pattern) and roughly constant spread (no heteroscedasticity); mean of residuals for a least-squares line is about 0. For a quick refresher, see the Topic 2.7 study guide (https://library.fiveable.me/ap-statistics/unit-2/residuals/study-guide/zdTJQZw0UVGswyK6kkEF). For more unit review or practice, check the Unit 2 page (https://library.fiveable.me/ap-statistics/unit-2) and the AP practice problems (https://library.fiveable.me/practice/ap-statistics).

How do I know if my linear model is appropriate using residuals?

Compute residuals (residual = y − ŷ) and make a residual plot (residuals vs explanatory variable or vs predicted ŷ). For a linear model to be appropriate you want: residuals scattered randomly around zero (no clear curve), roughly constant spread (homoscedasticity—no funnel shape), and no lone outliers or influential points. The least-squares line gives residuals with mean ≈ 0, so systematic patterns (U-shape, increasing/decreasing trend) mean the linear form is wrong. If spread changes with x (heteroscedasticity) prediction SEs will be off. Flag any big residuals for further check—they can be outliers or influential. On the AP exam you’ll use residual plots to justify whether a linear model is appropriate (CED DAT-1.E / DAT-1.F). Want practice? See the Topic 2.7 study guide (https://library.fiveable.me/ap-statistics/unit-2/residuals/study-guide/zdTJQZw0UVGswyK6kkEF) and try problems at (https://library.fiveable.me/practice/ap-statistics).

What does it mean when residuals look random on a plot?

A random-looking residual plot means your linear model is doing a good job of capturing the trend. Residuals are y − ŷ, and when you plot them (versus x or ŷ) you want to see no systematic pattern—just scatter centered near zero with roughly equal spread. That randomness supports a linear form (CED DAT-1.F.1), suggests homoscedasticity (constant variance), and means no obvious nonlinearity, omitted variable pattern, or cluster of influential points. If you see a curve, fan shape, or big outliers instead, the linear model is inappropriate (use a nonlinear model, transform, or investigate outliers). Residual checks are exactly how you verify the linearity assumption before doing slope inference on the AP exam (Topic 2.7, DAT-1.E/F). For a quick review, see the topic study guide (https://library.fiveable.me/ap-statistics/unit-2/residuals/study-guide/zdTJQZw0UVGswyK6kkEF). For extra practice, try problems at (https://library.fiveable.me/practice/ap-statistics).

How do I find predicted values to calculate residuals?

Start with the regression equation (least-squares line) ŷ = a + bx. To find a predicted value ŷ for a given explanatory x, plug that x into the equation and compute ŷ. Then compute the residual: residual = y − ŷ (observed minus predicted). Quick example: if ŷ = 10 + 2x and for one case x = 3 with observed y = 19, then ŷ = 10 + 2(3) = 16 and residual = 19 − 16 = 3. On the AP: you’ll usually get the regression equation from a calculator or problem statement (use your graphing calculator on the exam). Residuals are plotted versus x or ŷ to check model fit—randomness in that plot supports linearity; patterns or fan-shape signal nonlinearity or heteroscedasticity (CED DAT-1.E and DAT-1.F). For a quick review, see the Topic 2.7 study guide (https://library.fiveable.me/ap-statistics/unit-2/residuals/study-guide/zdTJQZw0UVGswyK6kkEF) and practice problems (https://library.fiveable.me/practice/ap-statistics).

I'm confused about residual plots - do I plot against x values or predicted values?

Either is okay—you can plot residuals (y − ŷ) against the original explanatory variable x or against the predicted values ŷ. The CED explicitly allows both: “residual plots are a plot of residuals versus explanatory variable values or predicted response values” (DAT-1.E.2). Which to pick: - Use residual vs x when you want to see whether the relationship between x and y is linear (look for no pattern). - Use residual vs ŷ when you want to check model fit and heteroscedasticity (patterns or “fanning” with ŷ show nonlinearity or unequal spread). What to look for: residuals should scatter randomly around 0 (mean of residuals ≈ 0). Any systematic curve or changing spread means the linear model may be inappropriate (DAT-1.F.1 and DAT-1.F.2). For quick AP review, see the Topic 2.7 study guide (https://library.fiveable.me/ap-statistics/unit-2/residuals/study-guide/zdTJQZw0UVGswyK6kkEF) and try practice problems at (https://library.fiveable.me/practice/ap-statistics).

What's the formula for calculating each residual point?

Each residual is just the observed y minus the predicted ŷ from your fitted line: residual = y − ŷ. If your least-squares line is ŷ = a + b x, compute ŷ for that x, then subtract from the actual y to get the residual for that point. Residuals are plotted (residual vs. x or residual vs. ŷ) to check linearity and equal spread (homoscedasticity). For least-squares regression the residuals sum (and mean) is about 0, so look for random scatter around zero—patterns suggest nonlinearity or problems. This matches the CED (DAT-1.E.1, DAT-1.E.2, DAT-1.F)—see the Topic 2.7 study guide (https://library.fiveable.me/ap-statistics/unit-2/residuals/study-guide/zdTJQZw0UVGswyK6kkEF) and try practice problems at (https://library.fiveable.me/practice/ap-statistics) to get comfortable calculating and interpreting residuals.

When residuals show a pattern instead of randomness, what does that tell me about my model?

If residuals show a clear pattern (curve, fan shape, clump, or trend) instead of random scatter around 0, that tells you the chosen model isn’t appropriate for the data. Specifically, for a linear least-squares model this violates the linearity assumption (CED DAT-1.F.1): the relationship between x and y is likely nonlinear or the variability changes with x (heteroscedasticity). It also means your predictions ŷ are biased in some x-range and inference about the slope may be invalid. Check for: a curved pattern → try a nonlinear model or transform x or y; a funnel/fan pattern → consider transforming to stabilize variance; one big residual → check for an outlier or influential point and whether it’s a data error or a special case. For AP exam framing, use a residual plot (residual = y − ŷ; DAT-1.E) to assess model appropriateness (DAT-1.F.2). Need practice interpreting residual plots? See the Topic 2.7 study guide (https://library.fiveable.me/ap-statistics/unit-2/residuals/study-guide/zdTJQZw0UVGswyK6kkEF), the Unit 2 overview (https://library.fiveable.me/ap-statistics/unit-2), and more practice problems (https://library.fiveable.me/practice/ap-statistics).

How do I interpret a residual plot that curves upward?

If the residual plot curves upward, that’s a red flag the linear model is missing a curved pattern. Remember residual = y − ŷ, and a good linear fit gives residuals scattered randomly around 0 (DAT-1.E/ DAT-1.F). A clear upward curve means residuals are systematically negative for some x-values and positive for others—the linearity assumption is violated (nonlinearity). What to do: try a curved model (add a quadratic term or use a log/other transform), or fit a nonlinear regression and compare fit. Also check for patterns in spread (heteroscedasticity) or outliers that could affect the shape. On the AP exam, you’d cite the patterned residuals as evidence the linear model is inappropriate (use residual plot to justify changing models—DAT-1.F.2). For a quick review, see the Topic 2.7 study guide (https://library.fiveable.me/ap-statistics/unit-2/residuals/study-guide/zdTJQZw0UVGswyK6kkEF) and try practice problems (https://library.fiveable.me/practice/ap-statistics).

Can you walk me through creating a residual plot from a data table?

Start with your data table of x (explanatory) and y (observed response). Steps: 1. Fit the least-squares line (use calculator or software) to get ŷ = a + bx and record ŷ for each row. (On the AP exam you can use a graphing calculator.) 2. For each observation compute the residual: residual = y − ŷ. (CED DAT-1.E.1) 3. Make a scatterplot with the explanatory variable x on the horizontal axis and the residual on the vertical axis (you may also plot residuals vs ŷ). (CED DAT-1.E.2) 4. Add a horizontal reference line at 0. Check the pattern: random scatter around 0 supports linearity/homoscedasticity; curved pattern suggests nonlinearity; funnel shape suggests heteroscedasticity; big isolated points are outliers/influential. (CED DAT-1.F.1–F.2) 5. Note that the mean of residuals for a least-squares fit is (approximately) 0. If you want guided practice or examples, see the Topic 2.7 study guide (https://library.fiveable.me/ap-statistics/unit-2/residuals/study-guide/zdTJQZw0UVGswyK6kkEF). For more unit review or 1000+ practice problems, check the Unit 2 page (https://library.fiveable.me/ap-statistics/unit-2) and practice hub (https://library.fiveable.me/practice/ap-statistics).

Why do we subtract predicted from actual instead of actual from predicted for residuals?

We define residual = actual − predicted (y − ŷ) because that sign makes the interpretation intuitive and consistent: a positive residual means the observed value is higher than the model predicted, and a negative residual means it’s lower. That convention is used in the CED (DAT-1.E.1) and in residual plots (DAT-1.E.2) so you can quickly read whether points lie above or below the fitted line. It also matters algebraically: least-squares regression chooses slope and intercept to minimize the sum of squared residuals Σ(y − ŷ)^2, and for those fitted values the residuals sum to (approximately) zero—another reason the y − ŷ form is standard. Residual plots (y − ŷ vs x or ŷ) help check linearity, constant variance, and outliers (DAT-1.F). For a clear review, check the Topic 2.7 study guide (https://library.fiveable.me/ap-statistics/unit-2/residuals/study-guide/zdTJQZw0UVGswyK6kkEF) and try practice problems at (https://library.fiveable.me/practice/ap-statistics).

What does apparent randomness in residuals actually look like on a graph?

Apparent randomness in a residual plot means the points look like a messy cloud with no clear pattern. You’d see residuals (y − ŷ) scattered above and below 0 roughly equally, with most points close to the horizontal line at 0 and no systematic curve, line, or cone shape. Key signs to check (CED language): mean of residuals ≈ 0, no nonlinearity, and roughly constant spread (homoscedasticity). What to watch for instead: a curved pattern (suggests nonlinearity), a funnel (spread increasing or decreasing → heteroscedasticity), clusters, or a few large residuals/outliers (possible influential points). If the residual plot shows apparent randomness, that supports a linear form for the association (DAT-1.F.1) and the chosen linear model is appropriate. For quick practice and more examples of residual plots, see the Topic 2.7 study guide (https://library.fiveable.me/ap-statistics/unit-2/residuals/study-guide/zdTJQZw0UVGswyK6kkEF) and try problems at (https://library.fiveable.me/practice/ap-statistics).