reconcile_top_down: Top-down hierarchical reconciliation (historical proportions)

View source: R/reconciliation.R

reconcile_top_downR Documentation

Top-down hierarchical reconciliation (historical proportions)

Description

Disaggregates one already-fit aggregate-level forecast down to each group by that group's fixed historical share of the total, instead of fitting (or summing) each group's own forecast shape the way reconcile_bottom_up() does. Coherent by construction (the shares sum to 1), and a meaningfully different result from bottom-up whenever the aggregate-level model captures dynamics the per-group models miss (or vice versa) – not just the same total recomputed a different way.

Usage

reconcile_top_down(fits, aggregate_forecast)

Arguments

fits

A named list of fit-result lists (one per group), each with ⁠$train⁠ (a tibble with ds/y) used only to compute historical proportions – ⁠$fc_tib⁠ is not used here (unlike reconcile_bottom_up(), which sums it). A NULL entry is dropped. A group whose historical total is zero/NA falls back to an equal share rather than a zero share.

aggregate_forecast

A tibble with ds/yhat columns (and optionally yhat_lower/yhat_upper) – a forecast fit directly on the summed series, not derived from fits.

Value

A list with fc_tib (aggregate_forecast's own columns, unchanged – the top-down total is the aggregate-level forecast), train/test (NULL; the caller already has the aggregate-level train/test that produced aggregate_forecast and should use those directly for display), components (the names of the groups whose historical shares were used), and proportions (a named list, one fixed share per group, summing to 1).

Examples

ds <- as.Date("2024-01-01") + 0:2
fits <- list(
  A = list(train = tibble::tibble(ds = ds, y = c(9, 10, 11))),
  B = list(train = tibble::tibble(ds = ds, y = c(1, 1, 1)))
)
aggregate_forecast <- tibble::tibble(ds = ds, yhat = c(10, 11, 12))
reconcile_top_down(fits, aggregate_forecast)

forecastsuite documentation built on Oct. 18, 2026, 5:08 p.m.