Internal Assessment

IB Math AI IA example: regression, residuals and prediction

A strong-looking regression statistic can hide a poor model. This Mathematics: applications and interpretation teaching example shows how to compare two fits, read their residuals and decide what the evidence allows you to predict.

IBvia study guide10 min readUpdated 07 November 2026DP1 & DP2

What kind of Math AI IA example is this?

AI means Applications and Interpretation. This is an original worked teaching extract about regression, not a full student IA, an assessed exemplar or a promise of a particular mark. Its small dataset is simulated, and all graphs below use those same invented values.

The IB describes Mathematics AI as a course that connects mathematics, technology and interpretation in context. Modelling and statistics are relevant to that emphasis, but the course also includes other mathematics, including calculus. Mathematics AA (Analysis and Approaches) is a separate course: methods can overlap, but an AA example is not an AI assessment reference. Choose the depth and methods with your teacher for your level and examination session.

Ask what the model should help you understand

Begin with a relationship and a purpose. An illustrative question is whether journey distance can help predict travel time for a clearly defined set of bus journeys. Define the population, route conditions and time period before looking for a high correlation. Decide what you need the model to do: describe an observed pattern, compare conditions or make a limited prediction.

Keep the question narrow enough that different rows describe comparable observations. Combining unrelated transport modes or different definitions of travel time may produce a tidy graph with an unclear interpretation.

Audit the dataset before fitting anything

Record the source, collection date, variable definitions, units and missing values. If you collect observations, agree the method with your teacher and follow school requirements for permissions and privacy. If you use published data, check whether categories or measurement methods changed during the period. Preserve the original dataset separately from your working version.

There is no universal sample size that makes every investigation convincing. Explain why your observations are sufficient for the question and what coverage is missing. Several measurements of the same journey may also share conditions and should not automatically be treated as fully independent.

Look at the scatter before choosing the model

Plot the observations with labelled axes. Examine the shape, spread, clusters and unusual values. Write down a provisional reason for choosing a linear or another suitable relationship. Investigate an unusual point using the original record. A transcription error can be corrected transparently; a genuine unusual journey may reveal something important about the model.

Choose mathematical techniques you can explain and that your teacher considers appropriate to your course. A fitted equation is useful only when its variables and coefficients have a clear meaning in the investigation.

Use residuals to challenge the fit

For an illustrative observation, suppose the fitted model predicts 18 minutes and the observed time is 23 minutes. The residual, observed minus predicted, is +5 minutes: the model underestimates that journey. Calculate residuals consistently and plot them against the explanatory variable or fitted values.

A curved pattern can suggest that a straight line misses part of the relationship. A widening spread can suggest that prediction becomes less precise for longer journeys. Describe the actual pattern in your plot before proposing a change. Avoid selecting models solely because one summary statistic improves.

Worked example: compare a line with a curve

Let x be journey distance in kilometres and y be duration in minutes. The teaching question is: What does a straight-line model miss in this constructed relationship? A real investigation would first need an actual purpose, traceable observations and comparable journey conditions.

The complete simulated dataset
Distance x (km)Duration y (min)
210.7
414.8
622.6
832.4
1043.7
1258.2
Two models fitted to the same simulated dataSix simulated distance and duration pairs. A straight line misses the upward curvature; a quadratic curve follows it closely. Both fits are drawn only between 2 and 12 kilometres.Same data, two fitted modelsDuration (min)020406024681012Distance (km)LinearQuadratic
Original IBvia illustration using simulated data. The dashed line is the least-squares linear fit; the solid curve is the least-squares quadratic fit. Dots are the six constructed observations, not recorded journeys.

Linear fit

ŷ = −3 + 4.77143x

R² ≈ 0.9682
Sum of squared residuals ≈ 52.363 min²

The positive slope describes an increase of about 4.77 predicted minutes per additional kilometre within this fitted relationship. The −3 minute intercept is not a plausible zero-distance journey duration.

Quadratic fit

ŷ = 8 + 0.64643x + 0.29464x²

R² ≈ 0.9997
Sum of squared residuals ≈ 0.506 min²

The curved model follows the constructed pattern much more closely. That is expected because we generated the data from a quadratic expression. It does not establish that a real journey should follow this equation.

Both models were fitted by ordinary least squares to the same six points, with an intercept included. Here R² = 1 − SSE/SST, where SSE is the sum of squared residuals and SST is the sum of squared deviations from the mean duration. These are in-sample comparisons: the data used to judge the fit were also used to estimate its coefficients. Displayed equations are rounded; retain more precision when calculating.

Read the pattern that R² hides

The linear R² is high, yet its errors are not patternless: the model underpredicts both ends and overpredicts the middle. That U-shaped pattern is a reason to question the straight-line form. Residual analysis complements a summary statistic; NIST explains why a high R² alone is insufficient.

A. Linear-model residualsThe residuals are positive at 2 and 12 kilometres and negative for the four distances between them: a curved pattern. Residual equals observed minus predicted duration. Both residual plots use a vertical range of minus 5 to plus 5 minutes.A. Linear-model residualsResidual (min) · same scale-5+0+524681012Distance (km)B. Quadratic-model residualsThe residuals range from minus 0.50 to plus 0.37 minutes, near the zero line on the same scale as the linear plot. Six constructed points do not establish random errors. Residual equals observed minus predicted duration. Both residual plots use a vertical range of minus 5 to plus 5 minutes.B. Quadratic-model residualsResidual (min) · same scale-5+0+524681012Distance (km)
Residual = observed − predicted duration. Both plots keep the same −5 to +5 minute vertical scale, so the size of the errors can be compared directly. The unrounded fitted coefficients were used for every plotted value.

Check one point yourself: x = 8 km

The simulated duration is 32.4 minutes.

Linear prediction: −3 + (4.771428…) × 8 = 35.1714…
Linear residual: 32.4 − 35.1714… ≈ −2.77 minutes.

Quadratic prediction: 8 + (0.646428…) × 8 + (0.294642…) × 8² = 32.0286…
Quadratic residual: 32.4 − 32.0286… ≈ +0.37 minutes.

The sign matters: the line overpredicts this duration; the curve underpredicts it slightly. A residual is a model discrepancy for an observation, not automatically the uncertainty of the measuring instrument.

The quadratic fit removes most of the visible curvature in this example, but it also estimates an extra coefficient. A better in-sample fit alone cannot establish better prediction. With only six deliberately constructed observations, we cannot establish independent, random errors or validate a model for a real population. Use contextual reasoning and, where feasible, independent observations to challenge a proposed model.

Make a limited, testable interpretation

Explain the slope in the correct units and the intercept in context. An intercept outside a sensible range may be a mathematical feature rather than a realistic zero-distance journey. Distinguish an association from a causal explanation: traffic, stops and time of day could influence journey duration alongside distance.

  • Keep predictions within the range you investigated unless you justify extrapolation.
  • Where feasible, test a prediction using observations not used to fit the model.
  • Compare errors with what would be useful for the real decision.
  • Explain limitations using evidence from the dataset, rather than a generic list.

When should you avoid extrapolation?

The demonstrated distances run from 2 to 12 km. At 20 km, the fitted line gives about 92.4 minutes and the fitted quadratic gives about 138.8 minutes. Both are easy to calculate; neither is supported by observations at that distance. Their disagreement exposes how much the answer depends on the chosen mathematical form.

Within the observed range

Interpolation can be a more defensible starting point when the new case shares the conditions represented in the data. It still has prediction error. A journey within the distance range but on a different kind of route may not be comparable.

Outside the observed range

Do not present an extrapolated output as a reliable forecast without additional justification. Seek relevant observations or contextual evidence for that range, reconsider the model, and state what remains uncertain.

For real journey data, a new transport mode, traffic regime, route type or definition of duration could matter even more than the numerical distance. In this simulated example there is no real service to predict: the outputs demonstrate the behaviour of fitted equations only.

Keep an understandable calculation trail

Save the software settings, fitted equation and plots, and show a representative calculation in your own working. Explain any exclusions or transformations. Finish by answering the original question at the strength your evidence supports. If the model is unreliable under certain conditions, that finding can guide a sensible refinement or a more cautious conclusion.

Your next-step checklist

Checklist choices stay in this browser.

Official course references and statistical background

The worked example, simulated data and figures are original IBvia teaching material. No student submission, assessment result or examiner review is represented. The IB sources establish course context and assessment dates; NIST provides general regression guidance, not IB marking rules.

Chat with IBviaClose contact

Contact IBvia

Chat on WhatsAppsunonewa03074@gmail.com
Tell us what you need.
CONTACT IBVIA

Let’s talk about your work.

Your enquiry: IB support

Continue to WhatsApp with your selected service already included. Tell us your subject and where you’d like to start.

For your first message

What are you working on?