csrec | R Documentation |
This function performs optimal (in least squares sense) combination cross-sectional forecast reconciliation for a linearly constrained (e.g., hierarchical/grouped) multiple time series (Wickramasuriya et al., 2019, Panagiotelis et al., 2022, Girolimetto and Di Fonzo, 2023). The reconciled forecasts are calculated using either a projection approach (Byron, 1978, 1979) or the equivalent structural approach by Hyndman et al. (2011). Non-negative (Di Fonzo and Girolimetto, 2023) and immutable (including Zhang et al., 2023) reconciled forecasts can be considered.
csrec(base, agg_mat, cons_mat, comb = "ols", res = NULL, approach = "proj",
nn = NULL, settings = NULL, bounds = NULL, immutable = NULL, ...)
base |
A ( |
agg_mat |
A ( |
cons_mat |
A ( |
comb |
A string specifying the reconciliation method. For a complete list, see cscov. |
res |
An ( |
approach |
A string specifying the approach used to compute the reconciled forecasts. Options include: |
nn |
A string specifying the algorithm to compute non-negative reconciled forecasts:
|
settings |
An object of class |
bounds |
A ( |
immutable |
A numeric vector containing the column indices of the base forecasts
( |
... |
Arguments passed on to
|
A (h \times n
) numeric matrix of cross-sectional reconciled forecasts.
Byron, R.P. (1978), The estimation of large social account matrices, Journal of the Royal Statistical Society, Series A, 141, 3, 359-367. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2307/2344807")}
Byron, R.P. (1979), Corrigenda: The estimation of large social account matrices, Journal of the Royal Statistical Society, Series A, 142(3), 405. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2307/2982515")}
Di Fonzo, T. and Girolimetto, D. (2023), Spatio-temporal reconciliation of solar forecasts, Solar Energy, 251, 13–29. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.solener.2023.01.003")}
Girolimetto, D. and Di Fonzo, T. (2023), Point and probabilistic forecast reconciliation for general linearly constrained multiple time series, Statistical Methods & Applications, in press. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s10260-023-00738-6")}.
Hyndman, R.J., Ahmed, R.A., Athanasopoulos, G. and Shang, H.L. (2011), Optimal combination forecasts for hierarchical time series, Computational Statistics & Data Analysis, 55, 9, 2579-2589. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.csda.2011.03.006")}
Panagiotelis, A., Athanasopoulos, G., Gamakumara, P. and Hyndman, R.J. (2021), Forecast reconciliation: A geometric view with new insights on bias correction, International Journal of Forecasting, 37, 1, 343–359. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.ijforecast.2020.06.004")}
Stellato, B., Banjac, G., Goulart, P., Bemporad, A. and Boyd, S. (2020), OSQP: An Operator Splitting solver for Quadratic Programs, Mathematical Programming Computation, 12, 4, 637-672. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s12532-020-00179-2")}
Wickramasuriya, S.L., Athanasopoulos, G. and Hyndman, R.J. (2019), Optimal forecast reconciliation for hierarchical and grouped time series through trace minimization, Journal of the American Statistical Association, 114, 526, 804-819. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/01621459.2018.1448825")}
Zhang, B., Kang, Y., Panagiotelis, A. and Li, F. (2023), Optimal reconciliation with immutable forecasts, European Journal of Operational Research, 308(2), 650–660. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.ejor.2022.11.035")}
Regression-based reconciliation:
ctrec()
,
terec()
Cross-sectional framework:
csboot()
,
csbu()
,
cscov()
,
cslcc()
,
csmo()
,
cstd()
,
cstools()
set.seed(123)
# (2 x 3) base forecasts matrix (simulated), Z = X + Y
base <- matrix(rnorm(6, mean = c(20, 10, 10)), 2, byrow = TRUE)
# (10 x 3) in-sample residuals matrix (simulated)
res <- t(matrix(rnorm(n = 30), nrow = 3))
# Aggregation matrix for Z = X + Y
A <- t(c(1,1))
reco <- csrec(base = base, agg_mat = A, comb = "wls", res = res)
# Zero constraints matrix for Z - X - Y = 0
C <- t(c(1, -1, -1))
reco <- csrec(base = base, cons_mat = C, comb = "wls", res = res) # same results
# Non negative reconciliation
base[1,3] <- -base[1,3] # Making negative one of the base forecasts for variable Y
nnreco <- csrec(base = base, agg_mat = A, comb = "wls", res = res, nn = "osqp")
recoinfo(nnreco, verbose = FALSE)$info
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.