Residuals Examples in Math

Start with the recap, study the fully worked examples, then use the practice problems to check your understanding of Residuals.

This page combines explanation, solved examples, and follow-up practice so you can move from recognition to confident problem-solving in Math.

Concept Recap

The difference between an observed value and its predicted value from a regression model: \text{residual} = y - \hat{y} (observed minus predicted).

A residual is how much the model got wrong for a specific data point. Positive residual means the actual value was higher than predicted; negative means it was lower. If you plot all residuals, the pattern (or lack thereof) tells you whether the model is appropriate.

Read the full concept explanation โ†’

How to Use These Examples

  • Read the first worked example with the solution open so the structure is clear.
  • Try the practice problems before revealing each solution.
  • Use the related concepts and background knowledge badges if you feel stuck.

What to Focus On

Core idea: A residual plot (residuals vs predicted values or vs x) is the diagnostic tool for regression. Random scatter = good model. Curved pattern = linear model is wrong. Fan shape = non-constant variance.

Common stuck point: Students compute residuals correctly but don't know how to read residual plots. The key: look for patterns. No pattern = good. Any systematic pattern = problem.

Worked Examples

Example 1

easy
Given \hat{y} = 2 + 3x, and observed point (4, 15): calculate the residual and interpret whether the model over- or under-predicts.

Solution

  1. 1
    Calculate predicted value: \hat{y} = 2 + 3(4) = 2 + 12 = 14
  2. 2
    Calculate residual: e = y - \hat{y} = 15 - 14 = 1
  3. 3
    Positive residual: actual value (15) is ABOVE the predicted value (14)
  4. 4
    Interpretation: the model under-predicts by 1 unit for this observation

Answer

e = 15 - 14 = 1 (positive). The model under-predicts by 1 unit.
A residual e = y - \hat{y} measures the vertical distance between observed and predicted. Positive residual = point above the line (model under-predicts); negative residual = point below the line (model over-predicts). Residuals should average to zero for a good model.

Example 2

medium
Five observed and predicted values: (y, \hat{y}): (10,8), (15,14), (12,13), (20,19), (8,11). Calculate all residuals, verify they sum to 0, and compute \sum e_i^2.

Practice Problems

Try these problems on your own first, then open the solution to compare your method.

Example 1

easy
A regression model gives residuals: \{3, -2, 4, -5, 0\}. Are these residuals consistent with a valid LSRL? Calculate \sum e_i and \sum e_i^2.

Example 2

hard
A residual plot shows residuals increasing in magnitude as \hat{y} increases (fan shape). What assumption is violated, and what does this mean for the validity of hypothesis tests in regression?

Background Knowledge

These ideas may be useful before you work through the harder examples.

linear regression lsrl