Hierarchical forecasting

Also known as: hierarchical time series

On this page 7

Hierarchical forecasting is the practice of predicting a collection of time series organized in aggregation levels, such as total sales, regional sales and store sales, and producing forecasts that are coherent, meaning that the lower-level forecasts add up exactly to the higher-level ones. Within time series and forecasting in artificial intelligence and statistics, it addresses a problem every large organization faces: different teams plan at different levels, yet their numbers must agree.

The data structure is often called a hierarchical time series. Forecasts produced independently at each level almost never sum correctly, so hierarchical methods add a reconciliation step that adjusts them into a consistent set, often improving accuracy as well.

How hierarchical time series are structured

A hierarchy is defined by a summing matrix, usually written S, that maps the most disaggregated series, the bottom level, to every aggregate above it. If b is the vector of bottom-level values, then all series together equal S multiplied by b. This linear constraint is the formal definition of coherence.

Many real collections are not a single tree. When products can be aggregated by category and also by region, the result is a grouped structure in which several hierarchies cross. Adding a time dimension, such as weekly, monthly and quarterly totals, creates temporal hierarchies. The table below compares these structures.

StructureTypical exampleKey property
Strict hierarchyCountry, region, storeEach node has one parent
Grouped structureProduct category crossed with regionSeveral aggregation paths to the total
Temporal hierarchyWeekly, monthly and quarterly demandSame series at different frequencies
Cross-temporal structureStore by product by monthCombines cross-sectional and temporal levels
Common aggregation structures

The size of a hierarchy grows quickly. A retailer with a few hundred stores and a few thousand products can easily reach hundreds of thousands of series, most of them short and sparse at the bottom. This imbalance of signal across levels is the central reason hierarchical methods exist: aggregates are smooth and predictable, while the bottom level holds the operational detail that planners actually need.

Approaches to hierarchical forecasting

There are four classic strategies for producing coherent forecasts, and they differ in which levels supply the information. Single-level methods forecast one level and derive the rest, while modern methods forecast every series and then reconcile them.

ApproachHow it worksStrengthWeakness
Bottom-upForecast bottom series, then sumKeeps local detailBottom series are often noisy
Top-downForecast total, split by proportionsStable aggregate signalLoses local dynamics
Middle-outForecast a middle level, sum up and split downBalances both endsChoice of level is arbitrary
Optimal reconciliationForecast all series, then adjust jointlyUses information from every levelNeeds covariance estimates
Main hierarchical forecasting strategies

The most widely used reconciliation method is MinT, or minimum trace reconciliation. It projects the independent base forecasts onto the coherent subspace while minimizing the total forecast error variance, using an estimate of the base forecast error covariance. Simpler variants such as OLS reconciliation and WLS with structural scaling assume a diagonal or identity covariance and are more robust when the hierarchy has thousands of series.

Hierarchical forecasting with machine learning models

Machine learning changes hierarchical forecasting in two ways. First, global forecasting models such as gradient boosting or DeepAR learn across all bottom-level series at once, which makes bottom-up forecasts far less noisy than with one statistical model per series. Second, reconciliation can be built into training rather than applied afterward.

End-to-end methods add a coherence penalty to the loss function or include the reconciliation projection as a differentiable layer. Probabilistic variants reconcile entire forecast distributions, so that prediction intervals at each level remain consistent, which matters for inventory and capacity planning.

AspectClassical pipelineMachine learning pipeline
Base modelsETS or ARIMA per seriesOne global model across series
ReconciliationPost-hoc MinT or OLSPost-hoc or learned in training
Exogenous covariatesLimited per-series inputsRich shared features
ScaleHundreds to thousands of seriesMillions of series feasible
InterpretabilityHighModerate to low
Statistical and machine learning options compared

Choosing a method in practice

The right strategy depends on where the signal lives and how noisy the bottom level is. When bottom series are long and regular, bottom-up performs well. When they are sparse or intermittent, aggregate levels carry most of the predictable structure, and reconciliation that blends all levels usually wins.

SituationRecommended approachReason
Regular, high-volume bottom seriesBottom-upDetailed patterns are reliable
Intermittent bottom demandMinT or WLS reconciliationBorrows strength from aggregates
Very large hierarchyWLS structural scalingAvoids unstable covariance estimates
Need for consistent intervalsProbabilistic reconciliationKeeps uncertainty coherent
Only total matters operationallyTop-down with historical proportionsSimplicity outweighs detail
Decision guide for method selection

Evaluation should use scale-free metrics such as MASE at every level, because absolute errors at the total level would otherwise dominate. Libraries including hts, fable and hierarchicalforecast implement the standard reconciliation methods.

Limitations and common pitfalls

  • Negative reconciled forecasts can appear for small series, because linear projections ignore non-negativity; constrained or nonnegative reconciliation fixes this.
  • Unstable covariance estimates in MinT arise when the number of series exceeds the history length; shrinkage estimators are the standard remedy.
  • Changing hierarchies, such as new stores or discontinued products, require rebuilding the summing matrix and handling short histories.
  • Evaluating only the total hides poor performance at the levels where operational decisions are made.

Reconciliation also cannot repair systematically biased base forecasts. If every base model misses a promotion effect, the reconciled forecasts will be coherent but still wrong, so base model quality remains the first priority.

A non-technical view

Imagine a company where each shop guesses its own sales for next month. The head office also makes its own guess for the whole country. The two sets of numbers rarely match. The shop guesses might add up to more than the national guess.

Hierarchical forecasting fixes this. It looks at all the guesses together and adjusts them gently. Every level then tells the same story. Shops, regions and the head office can plan with numbers that agree.

A concrete example

A grocery chain with 400 stores in 12 regions forecasts weekly demand for about 2,000 products, which gives roughly 800,000 bottom-level series. Warehouses order stock by region, stores staff by store total, and finance budgets at the national level.

The team trains one global gradient boosting model on all store-product series with price, promotion and holiday features, and separately forecasts regional and national totals. They then apply WLS reconciliation with structural scaling, because full MinT covariance estimation is unstable at this size, and clip small negative values to zero.

After reconciliation, regional warehouse forecasts improve noticeably on MASE compared with simple bottom-up sums, and finance, logistics and store managers now work from one consistent plan instead of three conflicting ones.