Reconciles a hierarchy using the minimum trace combination method. The response variable of the hierarchy must be aggregated using sums. The forecasted time points must match for all series in the hierarchy (caution: this is not yet tested for beyond the series length).
A column of models in a mable (e.g. mutate(ets = reconcile_mint(ets))),
a model data frame, or a model specification (e.g. model(ets = reconcile_mint(ETS(y)))).
The reconciliation method to use, which determines how the base forecast error covariance matrix is estimated.
If TRUE, the reconciliation will be computed using sparse matrix algebra? By default, sparse matrices will be used if the Matrix package is installed.
Used instead of model by the superseded names.
The "wls_var", "mint_cov" and "mint_shrink" methods require a positive
definite covariance matrix, which is not the case if two series in the
hierarchy are identical (e.g. an aggregate with only one child). Use
"wls_struct" or "ols" in these situations.
min_trace() is the original name of reconcile_mint(), and is kept for existing code.
New code should use reconcile_mint(), consistent with the other reconcile_*()
functions.
Wickramasuriya, S. L., Athanasopoulos, G., & Hyndman, R. J. (2019). Optimal forecast reconciliation for hierarchical and grouped time series through trace minimization. Journal of the American Statistical Association, 1-45. https://doi.org/10.1080/01621459.2018.1448825
library(fable)
lung_deaths_agg <- as_tsibble(cbind(mdeaths, fdeaths)) %>%
aggregate_key(key, value = sum(value))
lung_deaths_agg %>%
model(lm = TSLM(value ~ trend() + season())) %>%
dplyr::mutate(lm = reconcile_mint(lm, method = "mint_shrink")) %>%
forecast()
#> # A fable: 72 x 5 [1M]
#> # Key: key, .model [3]
#> key .model index
#> <chr*> <chr> <mth>
#> 1 fdeaths lm 1980 Jan
#> 2 fdeaths lm 1980 Feb
#> 3 fdeaths lm 1980 Mar
#> 4 fdeaths lm 1980 Apr
#> 5 fdeaths lm 1980 May
#> 6 fdeaths lm 1980 Jun
#> 7 fdeaths lm 1980 Jul
#> 8 fdeaths lm 1980 Aug
#> 9 fdeaths lm 1980 Sep
#> 10 fdeaths lm 1980 Oct
#> # ℹ 62 more rows
#> # ℹ 2 more variables: value <dist>, .mean <dbl>