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 l, it performs
base: A (h×nl) numeric matrix containing the l-level base forecast; nl is the number of variables at level l, and h is the forecast horizon.
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.
id_rows: A numeric vector indicating the l-level rows of agg_mat.
weights: A (h×nb) numeric matrix containing the proportions for the bottom time series; h is the forecast horizon, and nb is the total number of bottom variables.
normalize: If TRUE (default), the weights will sum to 1.
Returns
A (h×n) numeric matrix of cross-sectional 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)# (3 x 2) top base forecasts vector (simulated), forecast horizon = 3baseL2 <- matrix(rnorm(2*3,5),3,2)# Same weights for different forecast horizonsfix_weights <- runif(4)reco <- csmo(base = baseL2, agg_mat = A, id_rows =2:3, weights = fix_weights)# Different weights for different forecast horizonsh_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")