HTS package: how to specify a network forecast hierarchy?

I am trying to use the hts package for hierarchical forecasting , together to predict the different scales of the water supply network in order to harmonize the forecasts. A water network consists of flow meters that measure flow in a positive or negative state, and when we aggregate clean flows, this gives the domestic consumption of one neighborhood.

This is not a 100% hierarchical feeling, because: - the flowmeter is considered positive for a stream entering one neighborhood, but negative when leaving another neighborhood.

So, the structure is similar to this one, simplified with 3 flowmeters and two surroundings:

enter image description here

SO I tried to duplicate F2 meter, one positive and one negative, but the output is not satisfactory. How can I handle this?

 m=structure(c(28, 20, 20, 17, 19, 22, 26, 38, 45, 45, 42, 38, 37, 37, 33, 29, 28, 31, 37, 40, 36, 31, 26, 23, 22, 15, 13, 11, 11, 12, 16, 22, 25, 24, 21, 19, 17, 16, 14, 13, 13, 14, 16, 17, 16, 13, 11, 8, 7, 7, 8, 8, 8, 8, 8, 9, 11, 11, 11, 12, 12, 12, 11, 11, 11, 10, 10, 9, 9, 9, 8, 5), .Dim = c(24L, 3L), .Dimnames = list( NULL, NULL)) m=cbind(m, -m[, 3]) m[,2]<- -m[,2] colnames(m) <- c("NaF1", "NbF3", "NbF2", "NaF2") hm <- hts(m, characters=c(2, 2)) plot(hm); forecast(hm, fmethod="arima")$bts # # NaF1 NaF2 NbF2 NbF3 # 25 23.83012 -5.019900 4.799014 -8.505145 # 26 26.24205 -5.257814 4.989756 -10.778844 # 

As you can see, the F2 forecast differs in the positive and negative directions, which makes no sense.

To clarify the structure of aggregation, here is grafcet: enter image description here

+7
r graph time-series hierarchical forecasting
source share

No one has answered this question yet.

See related questions:

444
How to unload a package without restarting R
3
Prediction time series with forecast pack R
2
How to specify the minimum or maximum possible values ​​in the forecast?
2
Difference between imitation () and forecast () in the “forecast” package
one
simulate the Arama function from the prediction package
one
What is the proper way to predict the grouped time series specified through the hts packet in R?
0
Seasonality in auto.arima () from the forecast package
0
The specified forecast period, not limiting the forecast result
0
How to make predicted proportions for hts objects with two levels from top to bottom?
0
Hierarchical forecasting in R using HTS - Error in "characters ="

All Articles