ctmo | R Documentation |
The cross-temporal middle-out forecast reconciliation combines top-down
(cttd) and bottom-up (ctbu) methods in the cross-temporal framework for
genuine hierarchical/grouped time series. Given the base forecasts of an
intermediate cross-sectional level l
and aggregation order k
,
it performs
a top-down approach for the aggregation orders \geq k
and
cross-sectional levels \geq l
;
a bottom-up approach, otherwise.
ctmo(base, agg_mat, agg_order, id_rows = 1, order = max(agg_order),
weights, tew = "sum", normalize = TRUE)
base |
A ( |
agg_mat |
A ( |
agg_order |
Highest available sampling frequency per seasonal cycle (max. order
of temporal aggregation, |
id_rows |
A numeric vector indicating the |
order |
The intermediate fixed aggregation order |
weights |
A ( |
tew |
A string specifying the type of temporal aggregation. Options include:
" |
normalize |
If |
A (n \times h(k^\ast+m)
) numeric matrix of cross-temporal reconciled forecasts.
Middle-out reconciliation:
csmo()
,
temo()
Cross-temporal framework:
ctboot()
,
ctbu()
,
ctcov()
,
ctlcc()
,
ctrec()
,
cttd()
,
cttools()
,
iterec()
,
tcsrec()
set.seed(123)
# Aggregation matrix for Z = X + Y, X = XX + XY and Y = YX + YY
A <- matrix(c(1,1,1,1,1,1,0,0,0,0,1,1), 3, byrow = TRUE)
# (2 x 6) base forecasts matrix (simulated), forecast horizon = 3
# and intermediate aggregation order k = 2 (max agg order = 4)
baseL2k2 <- rbind(rnorm(3*2, 5), rnorm(3*2, 5))
# Same weights for different forecast horizons, agg_order = 4
fix_weights <- matrix(runif(4*4), 4, 4)
reco <- ctmo(base = baseL2k2, id_rows = 2:3, agg_mat = A,
order = 2, agg_order = 4, weights = fix_weights)
# Different weights for different forecast horizons
h_weights <- matrix(runif(4*4*3), 4, 3*4)
recoh <- ctmo(base = baseL2k2, id_rows = 2:3, agg_mat = A,
order = 2, agg_order = 4, weights = h_weights)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.