Forecasting and statistics

Backtesting (out-of-sample test)

Checking a forecasting model on periods it has not seen: hide the last months, forecast them and compare with what happened.

Key points

  • It is the only honest way to learn how well a model forecasts.
  • The result is compared with a simple benchmark, such as “next month will be like last month”.
  • A model that does not beat the simple benchmark is not worth the complexity.

Formula

Mean absolute error = average of |actual value − forecast| over the hidden months

Illustrative example

A company has 36 months of sales. It hides the last 6, fits the model on the first 30 and forecasts the 6. The model’s average error is 12,000 lei a month, against 30,000 lei for the “same month last year” benchmark. The model is worth using.

The company and figures in the example are illustrative.

Common mistakes

  • Testing the model on the same data it was fitted on.
  • A single test on one lucky period.
  • No simple benchmark to compare against.

Read more

Related terms

Forecast · Prediction interval · Seasonality · Overfitting · Naive benchmark · Mean absolute error (MAE)

← All glossary terms