| Title: | Coherent Forecast Combination for Linearly Constrained Multiple Time Series |
|---|---|
| Description: | Methods and tools designed to improve the forecast accuracy for a linearly constrained multiple time series, while fulfilling the linear/aggregation relationships linking the components (Girolimetto and Di Fonzo, 2024 <doi:10.48550/arXiv.2412.03429>). 'FoCo2' offers multi-task forecast combination and reconciliation approaches leveraging input from multiple forecasting models or experts and ensuring that the resulting forecasts satisfy specified linear constraints. In addition, linear inequality constraints (e.g., non-negativity of the forecasts) can be imposed, if needed. |
| Authors: | Daniele Girolimetto [aut, cre] (ORCID: <https://orcid.org/0000-0001-9387-1232>), Tommaso Di Fonzo [aut] (ORCID: <https://orcid.org/0000-0003-3388-7827>) |
| Maintainer: | Daniele Girolimetto <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.4.9000 |
| Built: | 2026-09-22 08:40:21 UTC |
| Source: | https://github.com/danigiro/foco2 |
Methods and tools designed to improve the forecast accuracy for a linearly constrained multiple time series, while fulfilling the linear/aggregation relationships linking the components (Girolimetto and Di Fonzo, 2024 doi:10.48550/arXiv.2412.03429). 'FoCo2' offers multi-task forecast combination and reconciliation approaches leveraging input from multiple forecasting models or experts and ensuring that the resulting forecasts satisfy specified linear constraints. In addition, linear inequality constraints (e.g., non-negativity of the forecasts) can be imposed, if needed.
Maintainer: Daniele Girolimetto [email protected] (ORCID)
Authors:
Tommaso Di Fonzo (ORCID)
Useful links:
Report bugs at https://github.com/danigiro/FoCo2/issues
Extended version of the
FoReco::cscov
function, introducing two new approximations for the covariance matrix
(both shrunk and sample versions). Specifically, shrbe/sambe
assume no correlation between experts, while shrbv/sambv
assume no correlation between variables.
## S3 method for class 'shrbe' cscov(comb = "shrbe", ..., n = NULL, p = NULL, matNA = NULL, res = NULL, mse = TRUE, shrink_fun = NULL) ## S3 method for class 'sambe' cscov(comb = "sambe", ..., n = NULL, p = NULL, matNA = NULL, res = NULL, mse = TRUE) ## S3 method for class 'shrbv' cscov(comb = "shrbv", ..., n = NULL, p = NULL, matNA = NULL, res = NULL, mse = TRUE, shrink_fun = NULL) ## S3 method for class 'sambv' cscov(comb = "sambv", ..., n = NULL, p = NULL, matNA = NULL, res = NULL, mse = TRUE)## S3 method for class 'shrbe' cscov(comb = "shrbe", ..., n = NULL, p = NULL, matNA = NULL, res = NULL, mse = TRUE, shrink_fun = NULL) ## S3 method for class 'sambe' cscov(comb = "sambe", ..., n = NULL, p = NULL, matNA = NULL, res = NULL, mse = TRUE) ## S3 method for class 'shrbv' cscov(comb = "shrbv", ..., n = NULL, p = NULL, matNA = NULL, res = NULL, mse = TRUE, shrink_fun = NULL) ## S3 method for class 'sambv' cscov(comb = "sambv", ..., n = NULL, p = NULL, matNA = NULL, res = NULL, mse = TRUE)
comb |
A string specifying the reconciliation method.
|
... |
Arguments passed on to
|
n |
Total number of variables, |
p |
Total number of experts, |
matNA |
A ( |
res |
A list of |
mse |
If |
shrink_fun |
Shrinkage function of the covariance matrix,
|
A () symmetric positive (semi-)definite matrix, with
, .
Other Optimal combination:
csmtc(),
csocc(),
occmat(),
temtc(),
teocc()
This function computes the optimal multi-task linear forecast combination, as described in Girolimetto and Di Fonzo (2024)
csmtc(base, comb = "ols", res = NULL, approach = "proj", nn = NULL, settings = NULL, bounds = NULL, agg_mat = NULL, ...)csmtc(base, comb = "ols", res = NULL, approach = "proj", nn = NULL, settings = NULL, bounds = NULL, agg_mat = NULL, ...)
base |
A list of |
comb |
A string specifying the reconciliation method. For details, see cscov. |
res |
A list of |
approach |
A string specifying the approach used to compute the reconciled forecasts. Options include:
|
nn |
A string specifying the algorithm to compute non-negative forecasts:
|
settings |
An object of class |
bounds |
A matrix (see
|
agg_mat |
A ( |
... |
Arguments passed on to cscov. |
A () numeric matrix of cross-sectional multi-task combined forecasts.
Girolimetto, D. and Di Fonzo, T. (2024), Coherent forecast combination for linearly constrained multiple time series, doi:10.48550/arXiv.2412.03429.
Other Optimal combination:
cscov(),
csocc(),
occmat(),
temtc(),
teocc()
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)) ## BALANCED PANEL OF FORECASTS # Base forecasts' and residuals' lists brc <- list(base1, base2) erc <- list(res1, res2) # Aggregation matrix for Z = X + Y A <- t(c(1,1)) rrc <- csocc(base = brc, agg_mat = A, comb = "shr", res = erc) yc <- csmtc(base = brc, agg_mat = A, comb = "shr", res = erc) M <- occmat(base = brc, agg_mat = A, comb = "shr", p = 2, res = erc)$M M%*%t(yc)-t(rrc) ## UNBALANCED PANEL OF FORECASTS base2[, 2] <- res2[, 2] <- NA # Base forecasts' and residuals' lists bgc <- list(base1, base2) egc <- list(res1, res2) matNA <- matrix(1, 3, 2) matNA[2,2] <- 0 # Aggregation matrix for Z = X + Y A <- t(c(1,1)) rgc <- csocc(base = bgc, agg_mat = A, comb = "shr", res = egc) yc <- csmtc(base = bgc, agg_mat = A, comb = "shr", res = egc) M <- occmat(base = bgc, agg_mat = A, comb = "shr", p = 2, res = egc, matNA = matNA)$M M%*%t(yc)-t(rgc)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)) ## BALANCED PANEL OF FORECASTS # Base forecasts' and residuals' lists brc <- list(base1, base2) erc <- list(res1, res2) # Aggregation matrix for Z = X + Y A <- t(c(1,1)) rrc <- csocc(base = brc, agg_mat = A, comb = "shr", res = erc) yc <- csmtc(base = brc, agg_mat = A, comb = "shr", res = erc) M <- occmat(base = brc, agg_mat = A, comb = "shr", p = 2, res = erc)$M M%*%t(yc)-t(rrc) ## UNBALANCED PANEL OF FORECASTS base2[, 2] <- res2[, 2] <- NA # Base forecasts' and residuals' lists bgc <- list(base1, base2) egc <- list(res1, res2) matNA <- matrix(1, 3, 2) matNA[2,2] <- 0 # Aggregation matrix for Z = X + Y A <- t(c(1,1)) rgc <- csocc(base = bgc, agg_mat = A, comb = "shr", res = egc) yc <- csmtc(base = bgc, agg_mat = A, comb = "shr", res = egc) M <- occmat(base = bgc, agg_mat = A, comb = "shr", p = 2, res = egc, matNA = matNA)$M M%*%t(yc)-t(rgc)
This function implements the optimal linear coherent forecast combination for a linearly constrained (e.g., hierarchical/grouped) multiple time series combining forecasts from multiple sources (experts). The method minimizes forecast errors while ensuring that the resulting forecasts are coherent, meaning they satisfy the constraints across the time series. Using a linear constrained optimization approach, csocc combines forecasts from multiple experts, accounting for the relations between variables and constraints. In addition, linear inequality constraints (e.g. non-negative forecasts) can be imposed, if needed.
csocc(base, agg_mat, cons_mat, comb = "ols", res = NULL, approach = "proj", nn = NULL, settings = NULL, bounds = NULL, ...)csocc(base, agg_mat, cons_mat, comb = "ols", res = NULL, approach = "proj", nn = NULL, settings = NULL, bounds = NULL, ...)
base |
A list of |
agg_mat |
A ( |
cons_mat |
A ( |
comb |
A string specifying the reconciliation method. For details, see cscov. |
res |
A list of |
approach |
A string specifying the approach used to compute the reconciled forecasts. Options include:
|
nn |
A string specifying the algorithm to compute non-negative forecasts:
|
settings |
An object of class |
bounds |
A matrix (see
|
... |
Arguments passed on to cscov. |
If an expert does not provide a forecast for a given variable,
the missing value can be represented as NA.
For instance, consider a case where the number of experts is
, with variables and . If the
second and third experts do not provide forecasts for, respectively, the second and first variable,
the corresponding matrix in the base list will be as follows:
A () numeric matrix of cross-sectional combined and reconciled forecasts.
Di Fonzo, T. and Girolimetto, D. (2023), Spatio-temporal reconciliation of solar forecasts, Solar Energy, 251, 13–29. doi:10.1016/j.solener.2023.01.003
Girolimetto, D. and Di Fonzo, T. (2024), Coherent forecast combination for linearly constrained multiple time series, doi:10.48550/arXiv.2412.03429.
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. doi:10.1007/s12532-020-00179-2
Other Optimal combination:
cscov(),
csmtc(),
occmat(),
temtc(),
teocc()
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)) ## BALANCED PANEL OF FORECASTS # Base forecasts' and residuals' lists brc <- list(base1, base2) erc <- list(res1, res2) # Aggregation matrix for Z = X + Y A <- t(c(1,1)) rrc <- csocc(base = brc, agg_mat = A, comb = "wls", res = erc) # Zero constraints matrix for Z - X - Y = 0 C <- t(c(1, -1, -1)) rrc <- csocc(base = brc, cons_mat = C, comb = "wls", res = erc) # same results ## UNBALANCED PANEL OF FORECASTS base2[, 2] <- res2[, 2] <- NA # Base forecasts' and residuals' lists bgc <- list(base1, base2) egc <- list(res1, res2) # Aggregation matrix for Z = X + Y A <- t(c(1,1)) rgc <- csocc(base = bgc, agg_mat = A, comb = "shrbe", res = egc)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)) ## BALANCED PANEL OF FORECASTS # Base forecasts' and residuals' lists brc <- list(base1, base2) erc <- list(res1, res2) # Aggregation matrix for Z = X + Y A <- t(c(1,1)) rrc <- csocc(base = brc, agg_mat = A, comb = "wls", res = erc) # Zero constraints matrix for Z - X - Y = 0 C <- t(c(1, -1, -1)) rrc <- csocc(base = brc, cons_mat = C, comb = "wls", res = erc) # same results ## UNBALANCED PANEL OF FORECASTS base2[, 2] <- res2[, 2] <- NA # Base forecasts' and residuals' lists bgc <- list(base1, base2) egc <- list(res1, res2) # Aggregation matrix for Z = X + Y A <- t(c(1,1)) rgc <- csocc(base = bgc, agg_mat = A, comb = "shrbe", res = egc)
This function performs a two-step process designed to first combine forecasts from multiple models or experts and then apply reconciliation techniques to ensure coherence.
csscr(base, fc = "sa", comb = "ols", res = NULL, mse = TRUE, shrink = TRUE, nnw = FALSE, factorized = FALSE, ...)csscr(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 () 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. 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. doi:10.1016/j.ijforecast.2015.03.009.
Girolimetto, D. and Di Fonzo, T. (2024), Coherent forecast combination for linearly constrained multiple time series. 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. doi:10.2307/2344546
Sequential coherent combination:
cssrc()
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 <- csscr(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 <- csscr(base = base, cons_mat = C, comb = "wls", res = res, fc = "sa") # same results # Incoherent combined forecasts fc_comb <- csscr(base = base, comb = "none", fc = "sa") round(C %*% t(fc_comb), 3) # Incoherent forecastsset.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 <- csscr(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 <- csscr(base = base, cons_mat = C, comb = "wls", res = res, fc = "sa") # same results # Incoherent combined forecasts fc_comb <- csscr(base = base, comb = "none", fc = "sa") round(C %*% t(fc_comb), 3) # Incoherent forecasts
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.,
, see Girolimetto and Di Fonzo, 2024)
cssrc(base, fc = "sa", comb = "ols", res = NULL, mse = TRUE, shrink = TRUE, nnw = FALSE, factorized = FALSE, ...)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 () 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. 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. doi:10.1016/j.ijforecast.2015.03.009.
Girolimetto, D. and Di Fonzo, T. (2024), Coherent forecast combination for linearly constrained multiple time series. 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. 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 forecastsset.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
These functions compute the matrices required for the optimal coherent
forecast combination, as described in Girolimetto and Di Fonzo (2024), in the
cross-sectional (csocc, via occmat) and temporal (teocc, via
occmat_te) frameworks. These matrices serve as the foundation for
building forecasts that effectively combine the individual information from
multiple experts while ensuring coherence across the variables.
occmat(agg_mat, cons_mat, p = NULL, matNA = NULL, comb = "ols", res = NULL, approach = "proj", ...) occmat_te( matNA = NULL, p = NULL, agg_order, comb = "ols", tew = "sum", res = NULL, approach = "proj", ... )occmat(agg_mat, cons_mat, p = NULL, matNA = NULL, comb = "ols", res = NULL, approach = "proj", ...) occmat_te( matNA = NULL, p = NULL, agg_order, comb = "ols", tew = "sum", res = NULL, approach = "proj", ... )
agg_mat |
A ( |
cons_mat |
A ( |
p |
Total number of experts, |
matNA |
A ( |
comb |
A string specifying the reconciliation method. For details, see cscov. |
res |
A list of |
approach |
A string specifying the approach used to compute the reconciled forecasts. Options include:
|
... |
Arguments passed on to cscov. |
agg_order |
Highest available sampling frequency per seasonal cycle
(max. order of temporal aggregation, |
tew |
A string specifying the type of temporal aggregation. Options
include: " |
A list of matrices:
M |
Projection matrix. |
Omega |
Matrix of the combination weights of the optimal linear multi-task forecast combination. |
W |
Forecast error covariance matrix of the base forecasts. |
Wc |
Forecast error covariance matrix of the combined forecasts. |
Wtilde |
Forecast error covariance matrix of the reconciled combined forecasts. |
K |
Matrix that replicates a vector (see Girolimetto and Di Fonzo, 2024). |
Girolimetto, D. and Di Fonzo, T. (2024), Coherent forecast combination for linearly constrained multiple time series, doi:10.48550/arXiv.2412.03429.
Other Optimal combination:
cscov(),
csmtc(),
csocc(),
temtc(),
teocc()
This function computes the optimal multi-task linear forecast combination for a temporally constrained time series, as described in Girolimetto and Di Fonzo (2024). It is the temporal counterpart of csmtc. Unlike teocc, the combined forecasts are not constrained to be temporally coherent.
temtc( base, agg_order, comb = "ols", tew = "sum", res = NULL, approach = "proj", nn = NULL, settings = NULL, ... )temtc( base, agg_order, comb = "ols", tew = "sum", res = NULL, approach = "proj", nn = NULL, settings = NULL, ... )
base |
A list of |
agg_order |
Highest available sampling frequency per seasonal cycle
(max. order of temporal aggregation, |
comb |
A string specifying the reconciliation method. For details, see cscov. |
tew |
A string specifying the type of temporal aggregation. Options
include: " |
res |
A list of |
approach |
A string specifying the approach used to compute the combined forecasts. Options include:
|
nn |
A string specifying the algorithm to compute non-negative forecasts:
|
settings |
A list of control parameters.
|
... |
Arguments passed on to cscov. |
A () numeric vector of temporal multi-task
combined forecasts.
Girolimetto, D. and Di Fonzo, T. (2024), Coherent forecast combination for linearly constrained multiple time series, doi:10.48550/arXiv.2412.03429.
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. doi:10.1007/s12532-020-00179-2
Other Optimal combination:
cscov(),
csmtc(),
csocc(),
occmat(),
teocc()
set.seed(123) # Base forecasts' and residuals' lists for 2 experts, # quarterly series (m = 4, k in {4, 2, 1}), forecast horizon h = 1 base <- list(rnorm(7, rep(c(20, 10, 5), c(1, 2, 4))), rnorm(7, rep(c(20, 10, 5), c(1, 2, 4)))) res <- list(rnorm(70), rnorm(70)) # Temporal optimal multi-task forecast combination yc <- temtc(base = base, agg_order = 4, comb = "shr", res = res)set.seed(123) # Base forecasts' and residuals' lists for 2 experts, # quarterly series (m = 4, k in {4, 2, 1}), forecast horizon h = 1 base <- list(rnorm(7, rep(c(20, 10, 5), c(1, 2, 4))), rnorm(7, rep(c(20, 10, 5), c(1, 2, 4)))) res <- list(rnorm(70), rnorm(70)) # Temporal optimal multi-task forecast combination yc <- temtc(base = base, agg_order = 4, comb = "shr", res = res)
This function implements the optimal linear coherent forecast combination for a temporally constrained time series, combining forecasts from multiple sources (experts). It is the temporal counterpart of csocc: the method minimizes the forecast errors while ensuring that the combined forecasts are temporally coherent, meaning they satisfy the aggregation relations linking the high-frequency series and its temporally aggregated counterparts. Linear inequality constraints (e.g. non-negative forecasts) can be imposed, if needed.
teocc( base, agg_order, comb = "ols", tew = "sum", res = NULL, approach = "proj", nn = NULL, settings = NULL, ... )teocc( base, agg_order, comb = "ols", tew = "sum", res = NULL, approach = "proj", nn = NULL, settings = NULL, ... )
base |
A list of |
agg_order |
Highest available sampling frequency per seasonal cycle
(max. order of temporal aggregation, |
comb |
A string specifying the reconciliation method. For details, see cscov. |
tew |
A string specifying the type of temporal aggregation. Options
include: " |
res |
A list of |
approach |
A string specifying the approach used to compute the reconciled forecasts. Options include:
|
nn |
A string specifying the algorithm to compute non-negative forecasts:
|
settings |
A list of control parameters.
|
... |
Arguments passed on to cscov. |
If an expert does not provide a forecast for a given temporal aggregation
order, the corresponding values can be represented as NA and the panel
of forecasts is treated as unbalanced.
An object of class foreco (see foreco-class)
with a () numeric vector of temporal
reconciled forecasts.
Girolimetto, D. and Di Fonzo, T. (2024), Coherent forecast combination for linearly constrained multiple time series, doi:10.48550/arXiv.2412.03429.
Other Optimal combination:
cscov(),
csmtc(),
csocc(),
occmat(),
temtc()
set.seed(123) # Base forecasts' and residuals' lists for 2 experts, # quarterly series (m = 4, k in {4, 2, 1}), forecast horizon h = 1 base <- list(rnorm(7, rep(c(20, 10, 5), c(1, 2, 4))), rnorm(7, rep(c(20, 10, 5), c(1, 2, 4)))) res <- list(rnorm(70), rnorm(70)) # Temporal optimal coherent forecast combination reco <- teocc(base = base, agg_order = 4, comb = "shr", res = res)set.seed(123) # Base forecasts' and residuals' lists for 2 experts, # quarterly series (m = 4, k in {4, 2, 1}), forecast horizon h = 1 base <- list(rnorm(7, rep(c(20, 10, 5), c(1, 2, 4))), rnorm(7, rep(c(20, 10, 5), c(1, 2, 4)))) res <- list(rnorm(70), rnorm(70)) # Temporal optimal coherent forecast combination reco <- teocc(base = base, agg_order = 4, comb = "shr", res = res)