oct_bounds: Optimal cross-temporal bounds

View source: R/oct_bounds.R

oct_boundsR Documentation

Optimal cross-temporal bounds

Description

\loadmathjax

Function to export the constraints designed for the cross-sectional and/or temporal reconciled forecasts

Usage

oct_bounds(hts_bounds, thf_bounds, m, C, Ut)

Arguments

hts_bounds

(\mjseqnn \times 2) matrix with cross-sectional bounds: the first column is the lower bound, and the second column is the upper bound.

thf_bounds

(\mjseqn(k^\ast + m) \times 2) matrix with temporal bounds: the first column is the lower bound, and the second column is the upper bound.

m

Highest available sampling frequency per seasonal cycle (max. order of temporal aggregation, \mjseqnm), or a subset of \mjseqnp factors of \mjseqnm.

C

(\mjseqnn_a \times n_b) cross-sectional (contemporaneous) matrix mapping the bottom level series into the higher level ones.

Ut

Zero constraints cross-sectional (contemporaneous) kernel matrix \mjseqn(\mathbfU'\mathbfy = \mathbf0) spanning the null space valid for the reconciled forecasts. It can be used instead of parameter C, but nb (\mjseqnn = n_a + n_b) is needed if \mjseqn\mathbfU' \neq [\mathbfI \ -\mathbfC]. If the hierarchy admits a structural representation, \mjseqn\mathbfU' has dimension (\mjseqnn_a \times n).

Value

A matrix with the cross-temporal bounds.

See Also

Other utilities: Cmatrix(), FoReco2ts(), agg_ts(), arrange_hres(), commat(), ctf_tools(), hts_tools(), lcmat(), residuals_matrix(), score_index(), shrink_estim(), thf_tools()

Examples

data(FoReco_data)
# monthly base forecasts
mbase <- FoReco2matrix(FoReco_data$base, m = 12)$k1
# monthly residuals
mres <- FoReco2matrix(FoReco_data$res, m = 12)$k1

# For example, in FoReco_data we want that BA > 78, and C > 50
cs_bound <- matrix(c(rep(-Inf, 5), 78, -Inf, 50, rep(+Inf, 8)), ncol = 2)
## Cross-sectional reconciliation
csobj <- htsrec(mbase, C = FoReco_data$C, comb = "shr", res = mres, bounds = cs_bound)

# Extension of the constraints to the cross-temporal case
ct_bound <- oct_bounds(hts_bounds = cs_bound, m = 12)
## Cross-temporal reconciliation
obj <- octrec(FoReco_data$base, m = 12, C = FoReco_data$C, comb = "bdshr",
              res = FoReco_data$res, bounds = ct_bound)


FoReco documentation built on May 31, 2023, 5:17 p.m.