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