| cssmp | R Documentation |
This function performs cross-sectional probabilistic forecast
reconciliation using a sample-based approach (Panagiotelis et al., 2023,
Girolimetto et al., 2024) for linearly constrained (e.g., hierarchical or
grouped) multiple time series. Given an array of L simulated base
forecast draws, cssmp() applies a chosen FoReco reconciliation
independently to each draw, producing a coherent sample distribution of
reconciled forecasts. Typical choices for the reconciliation include optimal
combination (csrec) as well as top-down (cstd), middle-out (csmo),
bottom-up (csbu), and level-conditional (cslcc) approaches.
cssmp(sample, fun = csrec, ...)
sample |
A ( |
fun |
A string specifying the reconciliation function to be used, as implemented in FoReco. |
... |
Arguments passed on to |
A distributional::dist_sample object.
Girolimetto, D., Athanasopoulos, G., Di Fonzo, T. and Hyndman, R.J. (2024), Cross-temporal probabilistic forecast reconciliation: Methodological and practical issues. International Journal of Forecasting, 40, 3, 1134-1151. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.ijforecast.2023.10.003")}
Panagiotelis, A., Gamakumara, P., Athanasopoulos, G. and Hyndman, R.J. (2023), Probabilistic forecast reconciliation: Properties, evaluation and score optimisation, European Journal of Operational Research 306(2), 693–706. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.ejor.2022.07.040")}
Probabilistic reconciliation:
csmvn(),
ctmvn(),
ctsmp(),
temvn(),
tesmp()
Cross-sectional framework:
csboot(),
csbu(),
cscov(),
cslcc(),
csmo(),
csmvn(),
csrec(),
cstd(),
cstools()
set.seed(123)
A <- matrix(c(1,1,1,1, # Z = X + Y
1,1,0,0, # X = XX + XY
0,0,1,1), # Y = YX + YY
nrow = 3, byrow = TRUE)
rownames(A) <- c("Z", "X", "Y")
colnames(A) <- c("XX", "XY", "YX", "YY")
# (100 x 7) base forecasts sample (simulated) for h = 1
base_h1 <- matrix(rnorm(100*7, mean = c(20, rep(10, 2), rep(5, 4))),
100, byrow = TRUE)
# (100 x 7) base forecasts sample (simulated) for h = 2
base_h2 <- matrix(rnorm(100*7, mean = c(20, rep(10, 2), rep(5, 4))),
100, byrow = TRUE)
# (2 x 7 x 100) base forecasts sample array with
# 2 forecast horizons, 7 time series and 100 sample
base_sample <- aperm(simplify2array(list(base_h1, base_h2)), c(3,2,1))
# Top-down probabilistic reconciliation
reco_dist_td <- cssmp(base_sample[, 1, , drop = FALSE], agg_mat = A,
fun = cstd, weights = c(0.3, 0.2, 0.1, 0.4))
# Middle-out probabilistic reconciliation
reco_dist_mo <- cssmp(base_sample[, c(2,3), , drop = FALSE], agg_mat = A,
fun = csmo, weights = c(0.3, 0.7, 0.8, 0.2),
id_rows = 2:3)
# Bottom-up probabilistic reconciliation
reco_dist_bu <- cssmp(base_sample[,-c(1:3),], agg_mat = A, fun = csbu)
# Level conditional coherent probabilistic reconciliation
reco_dist_lcc <- cssmp(base_sample, agg_mat = A, fun = cslcc)
# Optimal cross-sectional probabilistic reconciliation
reco_dist_opt <- cssmp(base_sample, agg_mat = A)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.