This function performs cross-sectional probabilistic forecast reconciliation assuming a multivariate normal base forecast distribution (Panagiotelis et al., 2023; Girolimetto et al., 2024; Wickramasuriya, 2024) for linearly constrained (e.g. hierarchical or grouped) multiple time series.
csmvn(base, agg_mat, cons_mat, comb = "ols", res = NULL,
approach = "proj", comb_base = comb, reduce_form = FALSE, ...)A distributional::dist_multivariate_normal object.
A (\(h \times n\)) numeric matrix or multivariate time series
(mts class) containing the base forecasts to be reconciled; \(h\)
is the forecast horizon, and \(n\) is the total number of time series
(\(n = n_a + n_b\)).
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: each row represents a constraint equation, and each column represents a variable. The matrix can be of full rank, meaning the rows are linearly independent, but this is not a strict requirement, as the function allows for redundancy in the constraints.
A string specifying the reconciliation method. For a complete list, see cscov.
An (\(N \times n\)) optional numeric matrix containing the in-sample residuals or validation errors. This matrix is used to compute some covariance matrices.
A string specifying the approach used to compute the reconciled mean and covariance matrix. Options include:
"proj" (default): Projection approach according to
Byron (1978, 1979).
"strc": Structural approach as proposed by Hyndman et
al. (2011).
A string specifying the base covariance matrix approach.
For a complete list, see cscov. Default is the equal to comb.
A logical parameter indicating whether the function
should return the full distribution (FALSE, default) or
only the distribution corresponding to the bottom-level time series
(TRUE).
Arguments passed on to cscov
mseIf TRUE (default) the errors used to compute the
covariance matrix are not mean-corrected.
shrink_funShrinkage function of the covariance matrix, shrink_estim (default).
Byron, R.P. (1978), The estimation of large social account matrices, Journal of the Royal Statistical Society, Series A, 141, 3, 359-367. tools:::Rd_expr_doi("10.2307/2344807")
Byron, R.P. (1979), Corrigenda: The estimation of large social account matrices, Journal of the Royal Statistical Society, Series A, 142(3), 405. tools:::Rd_expr_doi("10.2307/2982515")
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")
Hyndman, R.J., Ahmed, R.A., Athanasopoulos, G. and Shang, H.L. (2011), Optimal combination forecasts for hierarchical time series, Computational Statistics & Data Analysis, 55, 9, 2579-2589. tools:::Rd_expr_doi("10.1016/j.csda.2011.03.006")
Panagiotelis, A., Gamakumara, P., Athanasopoulos, G. and Hyndman, R.J. (2023), Probabilistic forecast reconciliation: Properties, evaluation and score optimisation, European Journal of Operational Research 306(2), 693–706. tools:::Rd_expr_doi("10.1016/j.ejor.2022.07.040")
Wickramasuriya, S. L. (2024). Probabilistic Forecast Reconciliation under the Gaussian Framework. Journal of Business & Economic Statistics, 42(1), 272–285. tools:::Rd_expr_doi("10.1080/07350015.2023.2181176")
Probabilistic reconciliation:
cssmp(),
ctmvn(),
ctsmp(),
temvn(),
tesmp()
Cross-sectional framework:
csboot(),
csbu(),
cscov(),
cslcc(),
csmo(),
csrec(),
cssmp(),
cstd(),
cstools()
set.seed(123)
# (2 x 3) base forecasts matrix (simulated), Z = X + Y
base <- matrix(rnorm(6, mean = c(20, 10, 10)), 2, byrow = TRUE)
# (10 x 3) in-sample residuals matrix (simulated)
res <- t(matrix(rnorm(n = 30), nrow = 3))
# Aggregation matrix for Z = X + Y
A <- t(c(1,1))
reco_dist <- csmvn(base = base, agg_mat = A, comb = "shr", res = res)
Run the code above in your browser using DataLab