csmo function

Cross-sectional middle-out reconciliation

Cross-sectional middle-out reconciliation

The middle-out forecast reconciliation (Athanasopoulos et al., 2009) combines top-down (cstd ) and bottom-up (csbu ) for genuine hierarchical/grouped time series. Given the base forecasts of variables at an intermediate level ll, it performs

  • a top-down approach for the levels \<l\<l;
  • a bottom-up approach for the levels l\>l.
csmo(base, agg_mat, id_rows = 1, weights, normalize = TRUE)

Arguments

  • base: A (h×nlh \times n_l) numeric matrix containing the ll-level base forecast; nln_l is the number of variables at level ll, and hh is the forecast horizon.
  • 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.
  • id_rows: A numeric vector indicating the ll-level rows of agg_mat.
  • weights: A (h×nbh \times n_b) numeric matrix containing the proportions for the bottom time series; hh is the forecast horizon, and nbn_b is the total number of bottom variables.
  • normalize: If TRUE (default), the weights will sum to 1.

Returns

A (h×nh \times n) numeric matrix of cross-sectional 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) # (3 x 2) top base forecasts vector (simulated), forecast horizon = 3 baseL2 <- matrix(rnorm(2*3, 5), 3, 2) # Same weights for different forecast horizons fix_weights <- runif(4) reco <- csmo(base = baseL2, agg_mat = A, id_rows = 2:3, weights = fix_weights) # Different weights for different forecast horizons h_weights <- matrix(runif(4*3), 3, 4) recoh <- csmo(base = baseL2, agg_mat = A, id_rows = 2:3, weights = h_weights)

References

Athanasopoulos, G., Ahmed, R. A. and Hyndman, R.J. (2009) Hierarchical forecasts for Australian domestic tourism. International Journal of Forecasting 25(1), 146–166. tools:::Rd_expr_doi("10.1016/j.ijforecast.2008.07.004")

See Also

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

Cross-sectional framework: csboot(), csbu(), cscov(), cslcc(), csrec(), cstd(), cstools()