reconcile_bottom_up: Bottom-up hierarchical reconciliation

View source: R/reconciliation.R

reconcile_bottom_upR Documentation

Bottom-up hierarchical reconciliation

Description

Sums already-fit per-group forecasts (and their actuals) instead of fitting the aggregate separately – the sum of individually-coherent group forecasts is itself always coherent by construction. Point forecasts sum exactly; prediction intervals are summed too, under the standard (if approximate) bottom-up assumption that group forecast errors are perfectly correlated – flagged as a known simplification, not a bug.

Usage

reconcile_bottom_up(fits)

Arguments

fits

A named list of fit-result lists (one per group), each with ⁠$fc_tib⁠ (a tibble with ds, yhat, and optionally yhat_lower/yhat_upper) and ⁠$train⁠/⁠$test⁠ (tibbles with ds, y). A NULL entry is dropped; a present entry missing a field is skipped for that field only, rather than erroring the whole reconciliation.

Value

A list with fc_tib, train, test (each summed by ds across groups, or NULL if no group supplied that field), and components (the names of the groups that were actually combined).

Examples

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

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