# Hierarchical time-series forecasting with complex aggregation constraints

I'm trying to forecast multiple time-series with a hierarchical structure using the hts package by prof. Hyndman. However, the aggregation constraints are not sums but rather a complex formulation (output of a non-linear regressor) of those different levels in the hierarchy.

One of the motivation for using hts remains as intended that lower levels in the hierarchy are uncertain while upper layers would be smoother. E.g.: prices at country levels are smoother, while those at city levels have higher variation, and I have mean and std of prices at each time-bin for bottommost level time series in the hierarchy.

After looking at many sources to handle this specific task, to no success, I'd like to understand the methodology for making forecasts at the bottom-most levels while still using information about the upper levels in the hierarchy. Can someone point me in the right direction and if there is a package for this?

Edit: By complex aggregation I mean that the aggregation function is unknown and would take some form of a weighted mean. The time series are an output of a non linear regression with predictions at bottommost levels in the hierarchy.

• Could you edit your question to include a little more information about your more complex aggregation constraints? Anything linear can be handled in the same way as hts does (you'd need to code up your own summation matrix, but that is not hard); anything nonlinear would require other treatment. – Stephan Kolassa Jan 27 '17 at 13:42
• – AnscombesGimlet Jan 27 '17 at 15:28
• Thanks for the edit. Can you be a little more precise? Perhaps add a smallish toy example of what kind of aggregation you have in mind for, say, a hierarchy consisting of only two time series? And what do you mean by "the aggregation function is unknown"? – Stephan Kolassa Mar 2 '18 at 7:55