Skip to content

How do you backtest a forecast, and how do backtests mislead?

A backtest tests a forecasting method on the past: from a date already gone by, using only that day's data, you forecast and compare with what happened, then move the date forward and repeat. It only counts if nothing known later leaks in and the rules are fixed in advance. VIDI by EE Partner is measured this way on closed cases.

Running a backtest without cheating on the calendar

Go back to a past date, pretend you know nothing about what came next, and let the method forecast. One date is an anecdote: a proper test moves the date forward a month at a time. Forecasters call it a rolling origin.

  1. Pin down the question

    What is forecast, and how far ahead: say, sales per shop three months out, when orders go in.

  2. Cut the data at the date

    Only what existed that day, in the version that existed that day.

  3. Forecast twice

    With the method under test and with a simple rule, such as the same month last year.

  4. Compare and move on

    Record the error of both, bad cases included, and repeat.

The method earns its place only if it beats the simple rule consistently: one that cannot beat “same as last year” adds cost and nothing else. How to measure the error is covered in the guide to forecast error.

How information from the future slips into a test

The most common flaw is in the data: something that did not exist on the day gets into the test and flatters it. This is look-ahead bias, and it usually happens because today's records are used to replay yesterday.

  • Figures corrected later: sales already net of returns booked months afterwards.
  • Whatever has disappeared: closed shops and discontinued products are missing, so only the survivors are tested (survivorship bias).
  • Facts known only afterwards: actual weather in place of the weather forecast.
  • Calculations on the whole history: a seasonal pattern estimated on every year already contains the years to be forecast.

The check is one question for every input: on that day, did the person deciding have this number, in this version? If not, replace it or drop it.

Forty variants tried, one shown: choices made with hindsight

Even with clean data, whoever builds a method tries many variants and keeps the best on the past. After forty attempts the winner is partly good and partly lucky, and the test cannot tell which. This is overfitting, and it applies to any choice made after seeing the numbers, such as dropping an “unusual” year.

The remedy is a locked drawer, usually called a hold-out period: the last part of the history stays out until the method is settled, and is opened once, after writing down how many variants were tried. If the result gets much worse there, the difference was luck. It is the logic of a placebo control: the comparison is fixed first.

The optician chain that thought its forecasts were tight

the rangethe numbercredible lowcredible high
The range is as wide as the error in an honest test. A flattered test makes both the range and the stock too narrow.

How many closed forecasts before you can say “right 8 times in 10”?

Even a clean test has a margin: eight right out of ten can hide a very different true skill, and the margin only narrows as tests accumulate.

Closed forecastsCorrectTrue skill roughly between
10849 and 94 in 100
302463 and 91 in 100
1008071 and 87 in 100
30024075 and 84 in 100
What an “8 in 10” is really worth, by number of tests. Rounded confidence intervals.

The tests must resemble the decision: a method that is good on frames says nothing about lead times. And they are not all independent: 20 shops over 24 months make 480 forecasts, but a wet summer hits every shop at once. When the forecast is a probability, the same test is read band by band: that is calibration.

When the months you tested stop resembling the months ahead

A backtest tells you how the method would have done under the conditions tested. When they change, for instance with contact lenses sold online, the result goes stale: look at the error period by period and rerun the test after every season.

Where VIDI does not help: when the past holds nothing similar, such as a shop format nobody has opened before. If there are not enough closed cases close to yours, the document says the answer rests on judgement rather than on a test.

The calendar VIDI keeps in its own tests

VIDI is held to the same discipline, on decisions already closed with the real outcome. The cases are split in time: those used for tuning are not those used for checking. Comparisons and measures are fixed before the results are known, each test is looked at once, and negative results stay on record in Method and measures.

95 out of 100

When VIDI by EE Partner is 90% sure or more, it's right 95 times out of 100.

Of 14,498 decisions already closed, mostly on European public tenders, this happens in 3,535: 3,364 of those answers are right. Internal tests by EE Partner. How we measure

In the document, how often VIDI has been right on questions like yours appears only with at least 30 test questions of the same kind. With fewer, it says so, as the sample document shows.

Common questions

Is a backtest the same as an out-of-sample test?
Almost. Out of sample means on cases not used to build the method. A backtest adds time: the test cases come later. With dated data, an out-of-sample test that mixes periods lets the future in.
How much history do you need to backtest a forecast?
Enough to build the method and then close many forecasts. With seasonal sales, at least two full seasons to build and another to test; with less, the margin tells you little.
Does a good backtest mean the method will work?
It means it would have worked under the conditions tested. If the market changes, the result goes stale, which is why the test is rerun every season.

Let's talk.

Do you have a forecasting method, your own or a supplier's, and doubt the test behind it? Let's talk.

The first question is free. The conditions

Let's talkinfo@ee-partner.com