cscov | R Documentation |
This function provides an approximation of the cross-sectional base forecasts errors covariance matrix using different reconciliation methods (see Wickramasuriya et al., 2019 and Di Fonzo and Girolimetto, 2023).
cscov(comb = "ols", n = NULL, agg_mat = NULL, res, mse = TRUE,
shrink_fun = shrink_estim, ...)
comb |
A string specifying the reconciliation method.
|
n |
Number of variables ( |
agg_mat |
A ( |
res |
An ( |
mse |
If |
shrink_fun |
Shrinkage function of the covariance matrix, shrink_estim (default). |
... |
Not used. |
A (n \times n
) symmetric positive (semi-)definite 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")}
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")}
Cross-sectional framework:
csboot()
,
csbu()
,
cslcc()
,
csmo()
,
csrec()
,
cstd()
,
cstools()
# Aggregation matrix for Z = X + Y
A <- t(c(1,1))
# (10 x 3) in-sample residuals matrix (simulated)
res <- t(matrix(rnorm(n = 30), nrow = 3))
cov1 <- cscov("ols", n = 3) # OLS methods
cov2 <- cscov("str", agg_mat = A) # STR methods
cov3 <- cscov("wls", res = res) # WLS methods
cov4 <- cscov("shr", res = res) # SHR methods
cov5 <- cscov("sam", res = res) # SAM methods
# Custom covariance matrix
cscov.ols2 <- function(comb, x) diag(x)
cscov(comb = "ols2", x = 3) # == cscov("ols", n = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.