View source: R/cs-sequential.R
cssrc | R Documentation |
This function applies a sequential method that first reconciles the base forecasts
from each expert to satisfy the linear constraints, and then combines the reconciled
forecasts obtained so far. cssrc may be applied only in 'balanced' cases (e.g.,
n_j = n
\forall j
, see Girolimetto and Di Fonzo, 2024)
cssrc(base, fc = "sa", comb = "ols", res = NULL, mse = TRUE, shrink = TRUE,
nnw = FALSE, factorized = FALSE, ...)
base |
A list of |
fc |
A string specifying the combination method:
|
comb |
A string specifying the reconciliation method: |
res |
A list of |
mse |
If |
shrink |
If |
nnw |
If |
factorized |
Value to be passed to the |
... |
Arguments passed on to
|
A (h \times n
) numeric matrix of cross-sectional combined and reconciled forecasts.
Bates, J. and Granger, C. W. (1969), The combination of forecasts, Operations Research Quarterly, 20, 451–468. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1057/jors.1969.103")}.
Conflitti, C., De Mol, C., and Giannone, D. (2015), Optimal combination of survey forecasts. International Journal of Forecasting, 31(4), 1096–1103. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.ijforecast.2015.03.009")}.
Girolimetto, D. and Di Fonzo, T. (2024), Coherent forecast combination for linearly constrained multiple time series. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.48550/arXiv.2412.03429")}.
Newbold, P. and Granger, C. W. (1974), Experience with forecasting univariate time series and the combination of forecasts, Journal of the Royal Statistical Society, A, 137, 131–146. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2307/2344546")}
Sequential coherent combination:
csscr()
set.seed(123)
# (2 x 3) base forecasts matrix (simulated), expert 1
base1 <- matrix(rnorm(6, mean = c(20, 10, 10)), 2, byrow = TRUE)
# (10 x 3) in-sample residuals matrix (simulated), expert 1
res1 <- t(matrix(rnorm(n = 30), nrow = 3))
# (2 x 3) base forecasts matrix (simulated), expert 2
base2 <- matrix(rnorm(6, mean = c(20, 10, 10)), 2, byrow = TRUE)
# (10 x 3) in-sample residuals matrix (simulated), expert 2
res2 <- t(matrix(rnorm(n = 30), nrow = 3))
# Base forecasts' and residuals' lists
base <- list(base1, base2)
res <- list(res1, res2)
# Aggregation matrix for Z = X + Y
A <- t(c(1,1))
reco <- cssrc(base = base, agg_mat = A, comb = "wls", res = res, fc = "sa")
# Zero constraints matrix for Z - X - Y = 0
C <- t(c(1, -1, -1))
reco <- cssrc(base = base, cons_mat = C, comb = "wls", res = res, fc = "sa") # same results
# WARNING!
reco_v <- cssrc(base = base, agg_mat = A, comb = "wls", res = res, fc = "var")
round(C %*% t(reco_v), 3) # Incoherent forecasts
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.