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

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

Arguments

hts_bounds

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

thf_bounds

(\((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, \(m\)), or a subset of \(p\) factors of \(m\).

C

(\(n_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 \((\mathbf{U}'\mathbf{y} = \mathbf{0})\) spanning the null space valid for the reconciled forecasts. It can be used instead of parameter C, but nb (\(n = n_a + n_b\)) is needed if \(\mathbf{U}' \neq [\mathbf{I} \ -\mathbf{C}]\). If the hierarchy admits a structural representation, \(\mathbf{U}'\) has dimension (\(n_a \times n\)).

Value

A matrix with the cross-temporal bounds.

See also

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)
#> [1] "c"
## Cross-temporal reconciliation
obj <- octrec(FoReco_data$base, m = 12, C = FoReco_data$C, comb = "bdshr",
              res = FoReco_data$res, bounds = ct_bound)
#> as(<dsCMatrix>, "dgCMatrix") is deprecated since Matrix 1.5-0; do as(., "generalMatrix") instead