csmo | R Documentation |
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
a top-down approach for the levels <l
;
a bottom-up approach for the levels >l
.
csmo(base, agg_mat, id_rows = 1, weights, normalize = TRUE)
base |
A ( |
agg_mat |
A ( |
id_rows |
A numeric vector indicating the |
weights |
A ( |
normalize |
If |
A (h \times n
) numeric matrix of cross-sectional reconciled forecasts.
Athanasopoulos, G., Ahmed, R. A. and Hyndman, R.J. (2009) Hierarchical forecasts for Australian domestic tourism. International Journal of Forecasting 25(1), 146–166. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.ijforecast.2008.07.004")}
Middle-out reconciliation:
ctmo()
,
temo()
Cross-sectional framework:
csboot()
,
csbu()
,
cscov()
,
cslcc()
,
csrec()
,
cstd()
,
cstools()
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.