View source: R/reconciliation.R
| reconcile_top_down | R Documentation |
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.
reconcile_top_down(fits, aggregate_forecast)
fits |
A named list of fit-result lists (one per group), each with
|
aggregate_forecast |
A tibble with |
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).
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.