ctrec | R Documentation |
This function performs optimal (in least squares sense) combination cross-temporal forecast reconciliation (Di Fonzo and Girolimetto 2023a, Girolimetto et al. 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 reconciled forecasts can be considered.
ctrec(base, agg_mat, cons_mat, agg_order, comb = "ols", res = NULL,
tew = "sum", approach = "proj", nn = NULL, settings = NULL,
bounds = NULL, immutable = NULL, ...)
base |
A ( |
agg_mat |
A ( |
cons_mat |
A ( |
agg_order |
Highest available sampling frequency per seasonal cycle (max. order
of temporal aggregation, |
comb |
A string specifying the reconciliation method. For a complete list, see ctcov. |
res |
A ( |
tew |
A string specifying the type of temporal aggregation. Options include:
" |
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 matrix with three columns (
For example, when working with a quarterly multivariate time series (
|
... |
Arguments passed on to
|
A (n \times h(k^\ast+m)
) numeric matrix of cross-temporal 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. (2023a), Cross-temporal forecast reconciliation: Optimal combination method and heuristic alternatives, International Journal of Forecasting, 39, 1, 39-57. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.ijforecast.2021.08.004")}
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., 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")}
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")}
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")}
Regression-based reconciliation:
csrec()
,
terec()
Cross-temporal framework:
ctboot()
,
ctbu()
,
ctcov()
,
ctlcc()
,
ctmo()
,
cttd()
,
cttools()
,
iterec()
,
tcsrec()
set.seed(123)
# (3 x 7) base forecasts matrix (simulated), Z = X + Y and m = 4
base <- rbind(rnorm(7, rep(c(20, 10, 5), c(1, 2, 4))),
rnorm(7, rep(c(10, 5, 2.5), c(1, 2, 4))),
rnorm(7, rep(c(10, 5, 2.5), c(1, 2, 4))))
# (3 x 70) in-sample residuals matrix (simulated)
res <- rbind(rnorm(70), rnorm(70), rnorm(70))
A <- t(c(1,1)) # Aggregation matrix for Z = X + Y
m <- 4 # from quarterly to annual temporal aggregation
reco <- ctrec(base = base, agg_mat = A, agg_order = m, comb = "wlsv", res = res)
C <- t(c(1, -1, -1)) # Zero constraints matrix for Z - X - Y = 0
reco <- ctrec(base = base, cons_mat = C, agg_order = m, comb = "wlsv", res = res)
# Immutable reconciled forecasts
# Fix all the quarterly forecasts of the second variable.
imm_mat <- expand.grid(i = 2, k = 1, j = 1:4)
immreco <- ctrec(base = base, cons_mat = C, agg_order = m, comb = "wlsv",
res = res, immutable = imm_mat)
# Non negative reconciliation
base[2,7] <- -2*base[2,7] # Making negative one of the quarterly base forecasts for variable X
nnreco <- ctrec(base = base, cons_mat = C, agg_order = m, comb = "wlsv",
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.