# Introduction to Hierarchical Time Series

May 8 · 5 min read

A time series is a dataset that tracks a sample over time and most of the articles about this series work on a specific/particular level of aggregation. But in the real world and many applications, there are multiple time series that are hierarchically organized. The related datasets have several levels is based on geography, branches, or other features and challenges start when we try to observe the information while focusing on the more granular level. A hierarchical time series is a hero for this situation.

But what is the hierarchical time series?

HTS is a collection of time series that follows a hierarchical aggregation structure. Let’s think about the number of Corona cases and see the basic data about that from the worlddometer website. Breakdowns can be seen easily. For example, regions and countries. It can be extended by cities or states.

The tourism demand by region and purpose is also another example of hierarchical time series. The easiest example would be geographical splitting. What is the logic behind the hierarchical time series? The top-level is the most aggregate level of the data. As we can see, the top level is divided into two series at a level which is disaggregated into two and two series at the second level of the hierarchy (Fig. 3).

y_t represents the tth level of the observation of the total series t=1,….., T.

y_j,t denotes the tth prediction of the series corresponding to node j.

For example, y_B,t denotes the tth observation of the series corresponding to node B at level 1.

The total number of our series is 1+2+2+2=7, while the number of series at the bottom-level is 2+2=4. The total number of series has to bigger than the number of series at the bottom level.

Let’s focus on the bottom level and see the equations.

We have also

from above equations and these equations can be more efficiently represented using matrix notation.

There are some main approaches to hierarchical time series forecasting like bottom-up, top-down, middle out. These methods first develop base forecasts by separately predicting each time series and then reconcile those base forecasts based on their inherent hierarchical structure.

The bottom-up approach

The bottom-up method calculates base forecasts for bottom-level time series and then aggregates them for upper-level time series. The bottom-up method calculates base forecasts for bottom-level time series and then aggregates them for upper-level time series.

We first generate h-step-ahead forecasts for each of the bottom-level series:

Summing these, we get h-step-ahead coherent forecasts for the rest of the series:

With this approach, we don’t lose information due to aggregations but it performs poorly on highly aggregated data. The other disadvantage is missing the relationship between the series, for example, between different countries.

The top-down approach

The top-down method calculates base forecasts only for a root time series and then disaggregates them according to historical proportions of lower-level time series.

be a set of disaggregation proportions that dictate how the forecasts of the total series are to be distributed to obtain forecasts for each series at the bottom level of the structure.

In our case, using proportions we get,

Each proportion p_j reflects the average of the historical proportions of the bottom-level series y_j,t over the period t=1,…, T relative to the total aggregate y_t

This approach is the simplest and reliable forecast for higher level(s). But we have lower accuracy at the lower levels.

The middle-out approach

The middle-out approach combines two methods, bottom-up and top-down approaches, and can be used on hierarchies with at least three levels. In this approach, we select the middle level and forecast it directly Other forecasts are generated for all the series at this level. For the series above the middle level, coherent forecasts are generated using the bottom-up approach by aggregating the “middle-level” forecasts upwards.

References

https://towardsdatascience.com/introduction-to-hierarchical-time-series-forecasting-part-i-88a116f2e2

https://robjhyndman.com/publications/hierarchical/

https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0242099

https://otexts.com/fpp2/reconciliation.html

## Geek Culture

A new tech publication by Start it up (https://medium.com/swlh).

Written by

## Geek Culture

A new tech publication by Start it up (https://medium.com/swlh).

## Market Basket Analysis using R

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app