← Writing

Research · · 8 min

Forecasts that add up

Consider a retail company with stores in several states of the USA. Four teams in the company forecast the same sales, each at its own level. The finance team forecasts total sales of the whole chain to set the budget. Regional managers forecast sales in each state. The store operations team forecasts each store to plan staff. The replenishment team forecasts each product in each store to place orders. When each team forecasts its level separately, the numbers do not match. The sum of the store forecasts differs from the state forecast, and the sum of the product forecasts differs from the chain forecast. Figure 1 shows this for a chain with three states and ten stores.

01 / One chain, four levels, four answers
Each level forecast separately: the numbers disagree
A chain with 3 states and 10 stores. Thousands of units over the next four weeks. Illustrative numbers.
Financegap −15k
Chain forecast1,280k
Sum of the three state forecasts1,265k
Regional managersgap −12k
The three state forecasts1,265k
Sum of the ten store forecasts1,253k
Store operationsgap −113k
The ten store forecasts1,253k
Sum of the product forecasts1,140k
Replenishmentgap +140k
Sum of the product forecasts1,140k
Chain forecast used by finance1,280k

Finance plans for 1,280k units. The product forecasts behind the orders sum to 1,140k, so 140k units of the budget have no order behind them.

California540kstores: 537kTexas330kstores: 333kWisconsin395kstores: 383k
Store forecastSum of its product forecasts
CA 1135k
−9.6%
CA 2140k
−16.4%
CA 3180k
−9.4%
CA 482k
−19.5%
California: state forecast 540k, sum of the store forecasts 537k, sum of the product forecasts 468k.
Figure 1. A chain of three states and ten stores, with illustrative numbers. Each team compares the forecast for its own level with the sum of the forecasts one level down. Switch between forecasts made separately for each level and reconciled forecasts, and select a state to see its stores.

Forecasts that disagree

Coherent forecasts: every level is consistent with the others.

A set of forecasts is said to be coherent when every level is consistent with the others. The forecast for a store equals the sum of the forecasts for its products. The forecast for a state equals the sum of the forecasts for its stores, and so on up to the chain. Turning separate forecasts into a coherent set is called hierarchical forecast reconciliation.

When forecasts are not coherent, each team plans with a different number. Finance approves a budget that does not match the orders placed by the stores. A regional manager sees a gap between the state forecast and the sum of the store forecasts and has to decide which one to use. When actual sales come in, it is hard to tell whether a miss came from demand or from the forecasts disagreeing with each other.

An old question

Economists asked in 1960 whether a model of the total does better than the sum of models of its parts, and forecasters asked the same question about regional forecasts in the 1970s. The topic now even has its own chapter in the standard forecasting textbook. Two longstanding approaches make the levels agree. Figure 2 shows how they move numbers through a small hierarchy.

  • Bottom-up. Forecast every product at the bottom level, for instance in every store, then sum. The levels are consistent, but the series of single products in single stores are sparse and noisy, and their errors accumulate in the sum.
  • Top-down. Forecast the total, then split it with historical shares. The levels are consistent too, but a fixed split cannot follow a store or a product whose sales change differently from the rest.

These approaches were designed for point forecasts. With probabilistic forecasts we cannot sum quantiles, as a quantile of a sum is not the sum of the lower-level quantiles. We thus draw samples from the marginal forecasts, with control over how they relate to one another.

Both of the above methods are usually less accurate than forecasting each level separately, which is why many planning teams keep forecasts that disagree. These are not the only reconciliation methods that exist.

The sum of the forecasts should equal the forecast of the sum.

02 / How the levels add up
Add the stores to get the chain
A miniature of the chain: two stores in each of two states. Start with four store forecasts, then add up.
Chain100California60Texas40CA 135CA 225TX 128TX 212
Add up with the summing matrix
A 1 means a store contributes to that row; a 0 means it does not.
Y: chain · CA · TX · CA 1 · CA 2 · TX 1 · TX 2
S: which stores belong to each level
B: the four store forecasts

Bottom-up adds the four store forecasts to get state and chain totals.

Figure 2. Illustrative two-state, four-store hierarchy. Switch between bottom-up summation and top-down allocation. Bottom-up uses the summing matrix Y = SB. Top-down uses historical shares B = AT to allocate a chain forecast T to the four stores. The hierarchy S stays the same.

The M5 competition

M5: Walmart daily sales, 12 levels, 42,840 series

One of the best-known benchmarks for this forecast reconciliation problem is the M5 competition. It is a Kaggle competition organised in 2020 by the University of Nicosia with data from Walmart. It asks for 28 days of daily unit sales for 3,049 products in 10 stores in California, Texas and Wisconsin, at 12 levels. The levels are the chain, each state, store, category and department, their combinations, each product, and each product in each store. That makes 42,840 series. Both tracks give every level the same weight in the score.

  • Accuracy track (5,507 teams, scored with WRMSSE). Teams submitted one forecast per product and store, and the organisers computed every other level by summing those forecasts. Every scored submission is therefore coherent, built bottom-up.
  • Uncertainty track (892 teams, scored with WSPL). Teams submitted nine percentiles for each of the 42,840 series separately. This track does not require coherent forecasts.

The winner of the Accuracy track combined 220 gradient-boosted tree models built for this dataset, one per store, per store and category and per store and department, each in two variants. Our post on the history of forecasting methods explains why gradient-boosted trees dominated M5.

What forecasting models do today

Foundation models for time series, including Chronos-2, Timestral and the public release of our own t0-gamma, are used today to forecast each level of a hierarchy independently, and their forecasts are not coherent.

Using public t0-gamma as released, we forecast each of the 42,840 M5 series independently and compared the forecast for each store with the sum of the forecasts for its products (Figure 3). In every store the two differ by 9% or more, and the forecast for the chain differs from the sum of its product forecasts by more than 10%.

03 / Measured on M5
The products and the store disagree
Public t0-gamma, as released, each level forecast separately. Size of the gap between the sum of the product forecasts and the forecast for their store, state or the chain, over the 28 test days.
Chain
All 10 stores13.4%
States
California14.0%
Texas10.5%
Wisconsin12.1%
Stores
CA 19.5%
CA 217.0%
CA 39.4%
CA 419.5%
TX 111.0%
TX 212.4%
TX 39.3%
WI 111.9%
WI 212.8%
WI 311.6%
Touch or hover a bar for its value.
Figure 3. Public t0-gamma, as released, on the 28 test days of M5, with a separate forecast for each level. Each bar is the size of the gap between the sum of the product forecasts in a store, state or the chain and the forecast for that store, state or chain.

A planning team that wants one set of numbers then has two options. It can keep the separate forecast for each level and accept the gaps, or sum the product forecasts bottom-up and lose accuracy at every level above them. On M5, these bottom-up forecasts score poorly. Public t0-gamma’s bottom-up forecast falls outside the top 50 solutions on the Uncertainty leaderboard. Chronos-2’s bottom-up forecast is even worse than the ARIMA baseline set by the organisers. ARIMA scores 0.2046. Chronos-2 scores 0.3240. For these bottom-up comparisons, we sum mean forecasts for point accuracy. We draw from marginal forecasts to estimate uncertainty because quantiles cannot be added to give the quantiles of the total.

Coherent forecasts from t0

We have developed an internal version of t0-gamma with support for hierarchical forecast reconciliation in mind. It also supports static covariates. Its forecasts are coherent at every level, and so are its uncertainty ranges, from one product in one store to the whole chain. Figure 4 compares public t0-gamma, forecasting each level independently as released, with the internal coherent version against actual daily sales for the chain, three states and ten stores. Figure 4 lets you inspect the forecasts for every node of the chain–state–store hierarchy shown. The comparison includes improvements to the model as well as reconciliation.

04 / The 28-day test window
Public and coherent forecasts, day by day
M5, 23 May–19 June 2016. Compare public t0-gamma as released, forecasting each level separately, with our internal coherent t0-gamma. Select a node; its average actual daily sales is indexed to 100. These are different model versions, not a reconciliation-only test.
WI store 2
23 May5 Jun19 Jun
23 May5 Jun19 Jun

Average daily error, indexed points (lower is better): public 9.5 · internal coherent 4.2.

Daily values for WI store 2
DateActualPublicInternal
2016-05-2381.585.783.4
2016-05-247279.977.4
2016-05-257775.575.6
2016-05-2678.276.875.6
2016-05-2784.88285.8
2016-05-2892.393.990
2016-05-2983.5102.681.2
2016-05-3071.694.286.7
2016-05-3170.799.182.8
2016-06-01104.510895
2016-06-02114.2118.2113.2
2016-06-03130.5110.9135.1
2016-06-04118124.6116.1
2016-06-05124.8130.7127.1
2016-06-06120.1112.8125.2
2016-06-0793.411099
2016-06-08105.2109.7113.1
2016-06-09118.5105.7116.5
2016-06-1098113.6102.7
2016-06-11128.4133.5128.5
2016-06-12131.4126.8136.1
2016-06-1393.1114.8100.1
2016-06-14115.3110.4113.6
2016-06-1511398.1116.8
2016-06-1697.294.894.1
2016-06-1796.3100.497.6
2016-06-18100.3105.3104.3
2016-06-1986.1104.589.2
Figure 4. Public t0-gamma (independent, as released) versus the first-place internal coherent t0-gamma on M5's 28 official test days. Actual sales and both forecasts are indexed per node to its average actual daily sales (= 100), so the vertical scale is comparable across nodes without plotting raw Walmart sales. Select the chain, a state or one of its stores. Both panels use the same vertical scale, with actual sales repeated in each. The lines show point forecasts (means).

Internal t0-gamma scores better than the coherent bottom-up forecasts of every public model we tested (Figure 5).

05 / The M5 leaderboards
Accuracy track: 1st of 5,507 teams
Overall WRMSSE on the official 28 days of the competition (lower is better), and the place each score would have taken among the published top 50.
Coherent at every levelRange of the published top 50: 1st 0.5204 to 50th 0.5760
Internal t0-gammacoherent at every leveltop 501st
Public t0-gammaas released, bottom-up from the products>50
Best M5 benchmarkexponential smoothing, bottom-up>50
Timestralas released, bottom-up from the products>50
Chronos-2as released, bottom-up from the products>50
Internal t0-gamma coherent at every level · WRMSSE 0.5169 · 1st
Places are among the 5,507 teams of the Accuracy track. Scores outside the top 50 have no exact rank in the published results.
Figure 5. Coherent forecasts from each model on M5's official 28-day test window, alongside published statistical benchmarks. Internal t0-gamma is coherent at every level. The public models were run as released and summed bottom-up from product forecasts. The dots show each model's overall score and where it would have placed on each leaderboard. The shaded band spans the scores of the published top 50 teams. A dot inside or left of it would have made the top 50. The statistical benchmark is the strongest of those the organisers published on each track.

The same internal t0-gamma would have placed 1st on both the Accuracy and Uncertainty tracks.

Results on M5

Internal t0-gamma scores 0.5169 on the Accuracy track and 0.1468 on the Uncertainty track. On the published leaderboards that is 1st of 5,507 teams, ahead of the winner at 0.5204, and 1st of 892, ahead of the winner at 0.1542. The public models are far behind when their forecasts are coherent (Figure 5).

M5 ran in 2020, and the field has learned from it since, so the comparison with the competitors of the time favours a model built today. Internal t0-gamma has not seen any data from the test window, 23 May to 19 June 2016.

What coherence means for a planning team

Today many planning teams forecast each level independently and live with the gaps. Others make the levels consistent with bottom-up or top-down, and accept a less accurate forecast at some levels. With internal t0-gamma, the budget, the regional plans, the store schedules and the orders come from one coherent set of forecasts, and the safety stock held in each store is consistent with the risk expected for the chain. When actual sales differ from the plan, the difference comes from demand, not from forecasts that disagree.