ctcov | R Documentation |
This function provides an approximation of the cross-temporal base forecasts errors covariance matrix using different reconciliation methods (Di Fonzo and Girolimetto, 2023, Girolimetto et al., 2023).
ctcov(comb = "ols", n = NULL, agg_mat = NULL, agg_order = NULL, res = NULL,
tew = "sum", mse = TRUE, shrink_fun = shrink_estim, ...)
comb |
A string specifying the reconciliation method.
|
n |
Cross-sectional number of variables. |
agg_mat |
A ( |
agg_order |
Highest available sampling frequency per seasonal cycle (max. order
of temporal aggregation, |
res |
A ( |
tew |
A string specifying the type of temporal aggregation. Options include:
" |
mse |
If |
shrink_fun |
Shrinkage function of the covariance matrix, shrink_estim (default). |
... |
Not used. |
A (n(k^\ast+m) \times n(k^\ast+m)
) symmetric matrix.
Di Fonzo, T. and Girolimetto, D. (2023), 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")}
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")}
Cross-temporal framework:
ctboot()
,
ctbu()
,
ctlcc()
,
ctmo()
,
ctrec()
,
cttd()
,
cttools()
,
iterec()
,
tcsrec()
set.seed(123)
# Aggregation matrix for Z = X + Y
A <- t(c(1,1))
# (3 x 70) in-sample residuals matrix (simulated),
# agg_order = 4 (annual-quarterly)
res <- rbind(rnorm(70), rnorm(70), rnorm(70))
cov1 <- ctcov("ols", n = 3, agg_order = 4) # OLS methods
cov2 <- ctcov("str", agg_mat = A, agg_order = 4) # STR methods
cov3 <- ctcov("csstr", agg_mat = A, agg_order = 4) # CSSTR methods
cov4 <- ctcov("testr", n = 3, agg_order = 4) # TESTR methods
cov5 <- ctcov("wlsv", agg_order = 4, res = res) # WLSv methods
cov6 <- ctcov("wlsh", agg_order = 4, res = res) # WLSh methods
cov7 <- ctcov("shr", agg_order = 4, res = res) # SHR methods
cov8 <- ctcov("sam", agg_order = 4, res = res) # SAM methods
cov9 <- ctcov("acov", agg_order = 4, res = res) # ACOV methods
cov10 <- ctcov("Sshr", agg_order = 4, res = res) # Sshr methods
cov11 <- ctcov("Ssam", agg_order = 4, res = res) # Ssam methods
cov12 <- ctcov("hshr", agg_order = 4, res = res) # Hshr methods
cov13 <- ctcov("hsam", agg_order = 4, res = res) # Hsam methods
cov14 <- ctcov("hbshr", agg_mat = A, agg_order = 4, res = res) # HBshr methods
cov15 <- ctcov("hbsam", agg_mat = A, agg_order = 4, res = res) # HBsam methods
cov16 <- ctcov("bshr", agg_mat = A, agg_order = 4, res = res) # Bshr methods
cov17 <- ctcov("bsam", agg_mat = A, agg_order = 4, res = res) # Bsam methods
cov18 <- ctcov("bdshr", agg_order = 4, res = res) # BDshr methods
cov19 <- ctcov("bdsam", agg_order = 4, res = res) # BDsam methods
# Custom covariance matrix
ctcov.ols2 <- function(comb, x) diag(x)
cov20 <- ctcov(comb = "ols2", x = 21) # == ctcov("ols", n = 3, agg_order = 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.