business-science / sweep

Extending broom for time series forecasting
https://business-science.github.io/sweep/
155 stars 31 forks source link

Combining forecasts #7

Closed tmerrittsmith closed 6 years ago

tmerrittsmith commented 6 years ago

Having generated multiple timeseries forecasts as described in Vignette SW01, I'd like to combine the forecasts to create an overall projection. How could this be done using the output of _fcast_tidy, which is a tibble of tibbles containing the forecasts for each dataset? Clearly I could just sum the forecasts, but how would I go about generating a confidence interval for this sum?

mdancho84 commented 6 years ago

Regarding forecasting confidence intervals, you might want to check out some of the packages that @topepo is working on including rsample and tidyposterior. The rsample package has a nice article on rolling origin resampling, which will help with confidence intervals of single or stacked model. rsample Time Time Series Analysis Example

tmerrittsmith commented 6 years ago

Thanks @mdancho84. I've also been looking at the hts package by Rob Hyndman, which includes some nice methods for creating hierarchical time series models. It feels like that's the natural next step with the examples and methods provided in sweep. Related to this would be the option to 'sweep' a tibble into an mts, or the tibble of tibbles or tibble of timeseries into an mts, so that hts could be implemented. I'm a bit of a noob in terms of git contributing, the broom package (as the parent of sweep) and timeseries methods in general, but would it be ok for me to try and extend sweep with some of this functionality?

mdancho84 commented 6 years ago

HTS is good. You can read about it more in Hyndman et als book here. It's just an approach that uses blended or hierarchical groups within an aggregated time series.

I actually don't use hts much. The forecast package suits most people (including me) because it has the arima and ets functions that are most commonly used. When you get into aggregating, you normally just do a bottom-up approach / top-down with proportions, which can be done with forecast for each group.

I'd recommend spending some time with arima() and auto.arima(). You can map() the modeling functions in the tidyverse, which is the best way to model in my opinion.