Skip to main content

Residual plot calculator: check your model's fit

A residual is data minus model. If a model is right, its residuals scatter randomly about zero; a curve in the residuals means the model has the wrong shape. Here a straight line is fitted to curved data, and the residual plot shows it.

The free IB Math Revision Grapher: A straight line fitted to curved practice data: the residual plot under it shows a clear ∩ shape
A straight line fitted to curved practice data: the residual plot under it shows a clear ∩ shape. Open it in the full Grapher.

How to do it

  1. Fit a model. Enter the data as a table and type a model with ~, for example y_1 ~ m x_1 + b.
  2. Open the residual plot. Tap residual plot under the fit: a small graph of the residuals against x appears under the line. Or type (x_1, e_1) to plot them on the main graph.
  3. Look for a pattern. What this model means runs a quick check for a curve or a trend in the residuals and for long runs of the same sign, and says what a pattern suggests. Here the ∩ shape says a quadratic would fit better.
  4. Try a better model. Type y_1 ~ a x_1^2 + b x_1 + c on a new line and compare the two residual plots and sums of squared residuals.
A straight line fitted to curved projectile data in the Grapher, with a residual plot below showing a curved pattern
The residual plot under a straight-line fit shows a ∩ shape: the model has the wrong shape.

Good to know

Frequently asked questions

What should a good residual plot look like?

Points scattered randomly above and below zero with no curve, no trend and no fan shape. A pattern means the model is missing something about the data.

How do I plot residuals?

Tap “residual plot” under any fit, or type (x_1, e_1) on a new line: e₁ is the residual list of the first fit.

Can I put the residual plot in my IA?

Yes. Export downloads the graph as a PNG or SVG and can include each open residual plot below it. Label it and explain what it shows in your own words.

Learn more

More Grapher guides

The Grapher is our own free tool (graph.mathrevision.co.uk), built for IB, A Level and IGCSE students. It is not an exam calculator: practise on your own GDC for calculator papers.