tcsrec | R Documentation |
tcsrec replicates the procedure by Kourentzes and Athanasopoulos (2019): (i) for each time series the forecasts at any temporal aggregation order are reconciled using temporal hierarchies; (ii) time-by-time cross-sectional reconciliation is performed; and (iii) the projection matrices obtained at step (ii) are then averaged and used to cross-sectionally reconcile the forecasts obtained at step (i). In cstrec, the order of application of the two reconciliation steps (temporal first, then cross-sectional), is inverted compared to tcsrec (Di Fonzo and Girolimetto, 2023).
# First-temporal-then-cross-sectional forecast reconciliation
tcsrec(base, cslist, telist, res = NULL, avg = "KA")
# First-cross-sectional-then-temporal forecast reconciliation
cstrec(base, cslist, telist, res = NULL)
base |
A ( |
cslist |
A list of elements for the cross-sectional reconciliation.
See csrec for a complete list (excluded |
telist |
A list of elements for the temporal reconciliation.
See terec for a complete list (excluded |
res |
A ( |
avg |
If |
A (n \times h(k^\ast+m)
) numeric matrix of cross-temporal reconciled forecasts.
The two-step heuristic reconciliation allows considering non negativity constraints only in the first step. This means that non-negativity is not guaranteed in the final reconciled values.
Di Fonzo, T. and Girolimetto, D. (2023), Cross-temporal forecast reconciliation: Optimal combination method and heuristic alternatives, International Journal of Forecasting, 39, 1, 39-57. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.ijforecast.2021.08.004")}
Kourentzes, N. and Athanasopoulos, G. (2019), Cross-temporal coherent forecasts for Australian tourism, Annals of Tourism Research, 75, 393-409. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.annals.2019.02.001")}
Cross-temporal framework:
ctboot()
,
ctbu()
,
ctcov()
,
ctlcc()
,
ctmo()
,
ctrec()
,
cttd()
,
cttools()
,
iterec()
set.seed(123)
# (3 x 7) base forecasts matrix (simulated), Z = X + Y and m = 4
base <- rbind(rnorm(7, rep(c(20, 10, 5), c(1, 2, 4))),
rnorm(7, rep(c(10, 5, 2.5), c(1, 2, 4))),
rnorm(7, rep(c(10, 5, 2.5), c(1, 2, 4))))
# (3 x 70) in-sample residuals matrix (simulated)
res <- rbind(rnorm(70), rnorm(70), rnorm(70))
A <- t(c(1,1)) # Aggregation matrix for Z = X + Y
m <- 4 # from quarterly to annual temporal aggregation
rtcs <- tcsrec(base = base,
cslist = list(agg_mat = A, comb = "shr"),
telist = list(agg_order = m, comb = "wlsv"),
res = res)
rcst <- tcsrec(base = base,
cslist = list(agg_mat = A, comb = "shr"),
telist = list(agg_order = m, comb = "wlsv"),
res = res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.