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 ≥k and cross-sectional levels ≥l;
base: A (nl×hk) numeric matrix containing the l-level base forecasts of temporal aggregation order k; nl is the number of variables at level l, k is an aggregation order (a factor of m, and 1<k<m), m is the max aggregation order, and h is the forecast horizon for the lowest frequency time series.
agg_mat: A (na×nb) numeric matrix representing the cross-sectional aggregation matrix. It maps the nb bottom-level (free) variables into the na upper (constrained) variables.
agg_order: Highest available sampling frequency per seasonal cycle (max. order of temporal aggregation, m), or a vector representing a subset of p factors of m.
id_rows: A numeric vector indicating the l-level rows of agg_mat.
order: The intermediate fixed aggregation order k.
weights: A (nb×hm) numeric matrix containing the proportions for each high-frequency bottom time series; nb is the total number of high-frequency bottom variables, m is the max aggregation order, and h is the forecast horizon for the lowest frequency time series.
tew: A string specifying the type of temporal aggregation. Options include: "sum" (simple summation, default), "avg" (average), "first" (first value of the period), and "last" (last value of the period).
normalize: If TRUE (default), the weights will sum to 1.
Returns
A (n×h(k∗+m)) numeric matrix of cross-temporal reconciled forecasts.
Examples
set.seed(123)# Aggregation matrix for Z = X + Y, X = XX + XY and Y = YX + YYA <- 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 = 4fix_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 horizonsh_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)