Forecasting Rolling origin Runs in your browser

Forecast Decision Lab

Three ordinary forecasting methods, judged the way a planner would actually experience them: refit at every origin, forecast forward, compare against what happened next, and never once look at a number the forecaster could not have seen. Then price the errors, because being wrong high and being wrong low almost never cost the same.

How the evaluation works

Rolling origin

A single train-test split gives you one number from one arbitrary cut point. Rolling origin walks the cut point forward instead. At origin t the lab hands each method only the values before t, takes its forecast for the next h periods, and scores it against what actually followed. Then the origin advances one period and the whole thing repeats. You end up with many forecasts made under many different histories, which is a much steadier read than one lucky or unlucky split.

Where leakage would creep in, and what stops it

Leakage is when a forecast is quietly built using information from after the moment it claims to be made. It is easy to introduce by accident and it makes every method look better than it is. Three places it would happen here, and how each is closed:

The self-tests below check this directly rather than taking it on trust: they overwrite the tail of the series with absurd numbers and confirm that every forecast made before that point comes back bit for bit identical.

The three methods

None of the three handles seasonality. If you build a scenario with a strong seasonal swing, expect all three to do poorly in a patterned way — that is the point of having the option.

Scoring on accuracy and on cost

Errors are defined as forecast − actual, so a positive error is an over-forecast. MAE and RMSE both treat the two directions as equally bad. The operational cost does not: over-forecasting is charged one rate per unit and under-forecasting another. In most supply chains those two numbers are nowhere near equal, and the method with the best RMSE is not always the method with the lowest cost. Watching those two rankings disagree is the most useful thing this lab does.

Set up the scenario

The series
Where the data comes from:

Set this to zero for no shift. A sudden change in demand can leave a forecast based on older observations behind.

Evaluation

How much history the first forecast is allowed to use.

Periods ahead, forecast from each origin.

Between 0 and 1. Ignored when refitting is on.

What errors cost

What a unit of surplus costs: holding, markdown, obsolescence.

What a unit of shortfall costs: lost margin, expediting, a missed promise.

Added to each forecast before scoring. Leave at zero to score the raw methods.

Self-tests

The leakage checks in here are the ones worth watching. They take a series, run the evaluation, then rewrite every value from some period onward with wildly different numbers and run it again. Any forecast made at or before that period must come back identical to the last decimal place; if it moves, the method peeked. The rest of the checks pin the arithmetic to values that can be worked out by hand.

Also callable from the console as window.runToolTests().

Things worth trying