GARETH GRANTTECHNOLOGY · DATA · INNOVATION
Explore

36 / Forecasting

Forecast validation, backtesting and error metrics

Forecast validation recreates historical prediction decisions using only the information that would have been available at the time. Rolling-origin evaluation, simple baselines and decision-relevant error measures provide a stronger basis for choosing a method than how neatly it fits its training data.

IntermediateLive exploration + Python

The business question

Does a forecasting method actually improve the decisions made from future demand estimates?

  • Compare demand forecasting methods before connecting them to replenishment.
  • Check whether a new model improves planning beyond last-value or seasonal baselines.
  • Monitor bias and error at the lead times that determine staffing, stock and service promises.

How the method works

Choose a forecast origin in the past, train or update the model using observations up to that origin, and forecast the required future horizon. Move the origin forward and repeat. This preserves the order in which information becomes available. Preprocessing, feature selection and parameter tuning must also use earlier data rather than leaking information from evaluation periods.

MAE averages absolute errors in the outcome’s original units. RMSE squares errors before averaging and taking a square root, so larger mistakes receive more weight. MASE scales MAE by the average absolute error of an appropriate naïve rule calculated on training data. A MASE below one means improvement relative to that training-scale benchmark, not necessarily superiority to a contemporaneous naïve model on the test set.

Metric choice should reflect the operating decision. Stockouts and excess stock have different costs, and one-week and three-month errors serve different lead times. MAPE can be undefined at zero and unstable near it. Report bias, uncertainty coverage and relevant segments as well as averages; overlapping forecast horizons also create dependent errors that should not be treated as independent evidence.

The calculation

error_t = actual_t−forecast_t; MAE = mean(|error|); RMSE = √mean(error²); MASE = MAE / mean_training(|y_t−y_(t−m)|)
Read the symbols
SymbolMeaning
mSeasonal lag for the scaling benchmark; m=1 for the nonseasonal example.
forecast originDate through which information is available for one prediction.
horizonHow far ahead the prediction is made.
training scaleNaïve absolute-error average estimated without future observations.

A worked business example

ILLUSTRATIVE SCENARIO

Illustrative twelve-period demand series compares a one-step naïve rule with a trailing three-period average.

Inputs

  • Demand: 100,105,110,108,115,120,118,125,130,128,135,140.
  • Begin evaluation after six training observations; forecast one period ahead at each of six subsequent origins.
  • Keep the MASE scaling denominator fixed from the initial six observations.

Work through the numbers

  1. The training naïve absolute changes are 5,5,2,7,5; their mean is 4.8.
  2. At each evaluation step, use only the latest available history: last actual for naïve, last three actuals for moving average.
  3. Naïve MAE≈4.667, RMSE≈5.099 and MASE≈0.972.
  4. Moving-average MAE≈6.667, RMSE≈7.029 and MASE≈1.389.
The naïve rule performs better than the three-period moving average on this small constructed holdout sequence.

The example shows why a smoother line need not be a better forecast. Six errors are not enough to establish a lasting advantage; compare more origins, appropriate seasonal periods and the actual decision horizon.

Explore the decision

Score forecasts against future observations. The live explorer has its own example inputs; it is separate from the worked calculation above.

Enable JavaScript to use this calculator. The worked example and executable Python remain available.

Apply it at work

  1. Specify the horizon, updating schedule, business loss and simple comparison methods in advance.
  2. Reserve a final later period and use earlier rolling origins for model and tuning choices.
  3. At every origin, rebuild the information set and calculate comparable errors, bias and interval coverage.
  4. Report performance by important regimes and update or retire models through a monitored decision process.

Check these assumptions

  • Historical records reproduce what was genuinely known at each forecast origin.
  • Evaluation periods and horizons represent the intended future operating decisions sufficiently well.
  • Every candidate uses equivalent information, outcomes and scoring rules.
  • The scaling benchmark is nonzero and appropriately chosen; dependent errors and structural changes are acknowledged.

Common mistakes and how to avoid them

  • Random train/test splits or full-series preprocessing can leak future information into the forecast.
  • A low in-sample residual error does not establish forecast accuracy.
  • A single aggregate score can hide serious peak-period shortages, systematic bias or poor performance for a critical product.

How this can help the business

  • A planning team can reject extra model complexity that fails to improve a simple operational baseline.
  • Error and bias measures can be translated into realistic inventory, staffing or service-risk simulations before deployment.
A decision rule to adapt

Choose the simplest maintainable method that performs acceptably on representative chronological evaluation at the required horizon and under the relevant cost and service constraints.

When to use another approach

Use an untouched later holdout, blocked or rolling cross-validation, asymmetric business-loss scoring, or probabilistic scoring when forecast uncertainty drives the decision.

Reproduce the worked example in Python

The code is self-contained for this example. Dependencies and run instructions are included with the downloadable notebook.

Show executable code and recorded output
import numpy as np
sales = np.array([100,105,110,108,115,120,118,125,130,128,135,140])
actual, naive, moving = [], [], []
for t in range(6,len(sales)):
    actual.append(sales[t])
    naive.append(sales[t-1])
    moving.append(sales[t-3:t].mean())
actual = np.array(actual)
scale = np.abs(np.diff(sales[:6])).mean()
for name, forecast in [("Naive",naive),("Moving average",moving)]:
    error = actual-np.array(forecast)
    mae = np.abs(error).mean()
    rmse = np.sqrt((error**2).mean())
    print(name, "MAE/RMSE/MASE:", round(mae,3), round(rmse,3), round(mae/scale,3))
print("Initial training-only scale:", round(scale,3))

Recorded output

Naive MAE/RMSE/MASE: 4.667 5.099 0.972
Moving average MAE/RMSE/MASE: 6.667 7.029 1.389
Initial training-only scale: 4.8
Download all worked examples

Sources and further reading

Concepts are linked to primary teaching or technical sources. The business examples are illustrative applications, not reported client results.