This function computes the projection or the mapping matrix \(\mathbf{M}\) and \(\mathbf{G}\), respectively, such that \(\widetilde{\mathbf{y}} = \mathbf{M}\widehat{\mathbf{y}} = \mathbf{S}_{cs}\mathbf{G}\widehat{\mathbf{y}}\), where \(\widetilde{\mathbf{y}}\) is the vector of the reconciled forecasts, \(\widehat{\mathbf{y}}\) is the vector of the base forecasts, \(\mathbf{S}_{cs}\) is the cross-sectional structural matrix, and \(\mathbf{M} = \mathbf{S}_{cs}\mathbf{G}\). For further information regarding on the structure of these matrices, refer to Girolimetto et al. (2023).
csprojmat(agg_mat, cons_mat, comb = "ols", res = NULL, mat = "M", ...)
The projection matrix \(\mathbf{M}\) (mat = "M"
) or
the mapping matrix \(\mathbf{G}\) (mat = "G"
).
A (\(n_a \times n_b\)) numeric matrix representing the cross-sectional aggregation matrix. It maps the \(n_b\) bottom-level (free) variables into the \(n_a\) upper (constrained) variables.
A (\(n_a \times n\)) numeric matrix representing the cross-sectional zero constraints. It spans the null space for the reconciled forecasts.
A string specifying the reconciliation method. For a complete list, see cscov.
An (\(N \times n\)) optional numeric matrix containing the in-sample residuals. This matrix is used to compute some covariance matrices.
A string specifying which matrix to return:
"M
" (default) for \(\mathbf{M}\) and "G
" for \(\mathbf{G}\).
Arguments passed on to cscov
mse
If TRUE
(default) the residuals used to compute the covariance
matrix are not mean-corrected.
shrink_fun
Shrinkage function of the covariance matrix, shrink_estim (default).
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. tools:::Rd_expr_doi("10.1016/j.ijforecast.2023.10.003")
Utilities:
FoReco2matrix()
,
aggts()
,
balance_hierarchy()
,
commat()
,
cstools()
,
ctprojmat()
,
cttools()
,
df2aggmat()
,
lcmat()
,
recoinfo()
,
res2matrix()
,
shrink_estim()
,
teprojmat()
,
tetools()
,
unbalance_hierarchy()
# Cross-sectional framework
A <- t(c(1,1)) # Aggregation matrix for Z = X + Y
Mcs <- csprojmat(agg_mat = A, comb = "ols")
Gcs <- csprojmat(agg_mat = A, comb = "ols", mat = "G")
Run the code above in your browser using DataLab