Search the complete library

What do you want to learn or calculate?

Quick linksAll calculatorsMath subjectsPractice questionsFormula library
← Statistics formulas

Residual

Measure vertical prediction error for one observation.

Statistics · Regression
$$e=y-\hat y$$

Residual is one of 3 regression formulas in the statistics section of this library, and it is used at high school · ap level.

Why residual works

It records what the model missed, in the units of the response and with a sign that says which way. The least-squares line is defined by making these values sum to zero and their squares as small as possible, so residuals are not a side product of fitting but the quantity the fit was built to control.

What each symbol means

$y$ is observed response and $\hat y$ predicted response.

Residual: when it holds

Positive residual means the observation lies above the fitted model.

When it stops applying

Residuals computed at the same points used to fit the model are optimistically small, because the line was tuned to those exact cases. A model can leave tiny residuals on its own data and still predict badly on new observations, so in-sample residuals alone never establish that a model is good.

Residual: a worked example

Observed $18$ and predicted $15$ give residual $3$.

The mistake to avoid

What people do: Computing predicted minus observed instead of observed minus predicted.

Why it goes wrong: The sign then reverses, so points above the line are reported as negative. Any conclusion about whether the model over- or under-predicts a case comes out backwards.

Do this instead: Fix the order in your head as actual first: what really happened, minus what the model said would happen.

Residual: step by step

  1. Name the unknown, and the unit the answer has to come out in.
  2. Match the symbols to your values. $y$ is observed response and $\hat y$ predicted response.
  3. Check the conditions before substituting. Positive residual means the observation lies above the fitted model.
  4. Substitute, keep exact values to the last line, then test the sign, size, and unit against a rough estimate — the check that catches most statistics slips.

Where this formula fits

Subject
Statistics formulas — 21 entries in this library
Topic
Regression
Level
High school · AP

Formulas are easiest to keep when they sit inside a method rather than on a list. Use the links below to see where residual comes from, to check a calculation against a tool, and to practise it until you can recall it without looking.

Questions about residual

What does a curved pattern in a residual plot tell me?

That a straight line is the wrong shape for the data. The line has absorbed the average trend but left a systematic bend behind, which usually calls for a transformation or a curved model.

Should residuals always add up to zero?

They do for a least-squares line that includes an intercept, since the fitting condition forces it. If yours do not, either the model has no intercept or there is an arithmetic error.

Is a residual the same thing as an error?

No. An error is the distance from the true underlying relationship, which nobody can observe. A residual is the distance from the fitted line, which is an estimate of that relationship.

How do residuals help me spot an unusual case?

Look for one that is far larger in size than the rest. That point deserves investigation, especially if it also sits at an extreme x value, where it can drag the whole line toward itself.

Stuck on a problem?

Work a residual problem step by step

Type your own problem, or upload a photo of it. You get the method, the answer, and a check you can repeat yourself.