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)
Run the code above in your browser using DataLab