6

I'm trying to use the hts package for hierarchical forecasting in order to predict together the different scales of a water network, in order to have reconciled forecasts. The water network is composed of flowmeters, that measure flow in positive or negative, and when we agregate the net flows it gives the internal consumption of one neighbourhood.

It's not 100% hierarchical sensu stricto because : - a flow meter is counted positively for the flow entering one neighbourhood, but negatively when exiting the other neighbourhood.

So the structure is like this, simplified with 3 flowmeters, and 2 neighbourhoods:

enter image description here

SO i tried to duplicate the 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 forecast of F2 is different in the positive and negative direction, which does not make sense.

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

agenis
  • 8,069
  • 5
  • 53
  • 102
  • the numbers don't seem to add up. Is neighbourhood b also 'adding' water to the network ? – R.S. Nov 20 '17 at 08:01
  • @R.S. thanks for ur comment. It's unsurprising that the net consumption of the neighbourhood is different from zero, since they are generally supposed to "consume" water (have a positive net term). But this is "fake" data: the interpretation of the numbers would be weird here i agree... Anyway it doesn't really matter, mathematically. – agenis Nov 20 '17 at 08:39
  • I'll admit that I do not have any experience with hierarchical TS, but I assumed that such a time series would have all its leaves sum up to the node above them. The HTS examples seems to suggest that too. Given this I would see the net consumption at N.a as a leaf for the node F2 . There is a paper on smart meters using HTS, though there seems to be no lateral flows in it, so I wonder if we can get the info from there – R.S. Nov 21 '17 at 09:45
  • indeed, the lower level are the flowmeters, the higher level the neighbourhoods, i guess i didn't make that clear enough. Don't know the paper you mention, but yes if it's purely hierarchical, it won't help. – agenis Nov 21 '17 at 17:08
  • 1
    The paper is here: https://robjhyndman.com/publications/hpf-electricity/ BTW , the hts package also has something called grouped time series ( gts ) I wonder if the structure applies here : https://www.rdocumentation.org/packages/hts/versions/5.1.4/topics/gts – R.S. Nov 21 '17 at 20:31

1 Answers1

0

Couldn't you just consider the F.2 negative value for N.a as a sub-node for N.a and the F.2 positive value for N.b as a sub node for N.b?

That would transform this into a simpler hierarchical structure.

Sam
  • 1
  • 2
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). – teunbrand Aug 27 '21 at 11:17