ctmo function

Cross-temporal middle-out reconciliation

Cross-temporal middle-out reconciliation

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 ll and aggregation order kk, it performs

  • a top-down approach for the aggregation orders k\geq k and cross-sectional levels l\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)

Arguments

  • base: A (nl×hkn_l \times hk) numeric matrix containing the ll-level base forecasts of temporal aggregation order kk; nln_l is the number of variables at level ll, kk is an aggregation order (a factor of mm, and 1<k<m1<k<m), mm is the max aggregation order, and hh is the forecast horizon for the lowest frequency time series.
  • agg_mat: A (na×nbn_a \times n_b) numeric matrix representing the cross-sectional aggregation matrix. It maps the nbn_b bottom-level (free) variables into the nan_a upper (constrained) variables.
  • agg_order: Highest available sampling frequency per seasonal cycle (max. order of temporal aggregation, mm), or a vector representing a subset of pp factors of mm.
  • id_rows: A numeric vector indicating the ll-level rows of agg_mat.
  • order: The intermediate fixed aggregation order kk.
  • weights: A (nb×hmn_b \times hm) numeric matrix containing the proportions for each high-frequency bottom time series; nbn_b is the total number of high-frequency bottom variables, mm is the max aggregation order, and hh 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)n \times h(k^\ast+m)) numeric matrix of cross-temporal reconciled forecasts.

Examples

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)

See Also

Middle-out reconciliation: csmo(), temo()

Cross-temporal framework: ctboot(), ctbu(), ctcov(), ctlcc(), ctrec(), cttd(), cttools(), iterec(), tcsrec()