Creating time series for HTS package

Hey everyone,

I need some help with transforming my data for it to be fit to perform hierarchial forecasting methods from the hts package. I want to use the method of Hyndman and found several explanations for this. However, you need to define a time series in which the levels and groups in the hierarhcy are specified but I cannot find any explanation about this. Does anyone know how to do this or where I can find proper explanation.

hts is retired, with minimum maintenance to keep it on CRAN. We recommend using the fable package instead

See tsibble in the tidyverts packages, which include fable:

Thank you for your response.
I looked at the fable package and I cannot really find how to perform hierarchial forecasting with this package?

There are multiple examples here: Chapter 11 Forecasting hierarchical and grouped time series | Forecasting: Principles and Practice (3rd ed)

Thank you very much for your answer this is really helfull. Now my only problem is that I cannot use the aggregate_key function on my dataset. I get the following error:

Error in UseMethod("aggregate_key") :
no applicable method for 'aggregate_key' applied to an object of class "c('tbl_df', 'tbl', 'data.frame')"

My dataset is similar to the one in the example.

Is your data in the tsibble format?

I am trying that now but r says my data has duplicates. I am not sure if I am transforming my data right.

The Forecasting: Principles and Practice book is an excellent resource. For example, Chapter 2 starts with a section on tsibbles.

1 Like

The text being referred to: Forecasting: Principles and Practice (3rd ed)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.