# NOT RUN {
data(FoReco_data)
# monthly base forecasts
mbase <- t(FoReco_data$base[, which(simplify2array(strsplit(
colnames(FoReco_data$base), split = "_"))[1, ] == "k1")])
#' # monthly residuals
mres <- t(FoReco_data$res[, which(simplify2array(strsplit(
colnames(FoReco_data$res),split = "_"))[1, ] == "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)
# }
Run the code above in your browser using DataLab