mitchelloharawild / fable.prophet

fable extension for the prophet forecasting procedure
https://pkg.mitchelloharawild.com/fable.prophet
55 stars 8 forks source link

Possible to acquire prediciction intervals for reconciled prophet forecasts? #29

Open henningsway opened 3 years ago

henningsway commented 3 years ago

Thank you for bringing prophet to fable!

I plan on using prophet in a hierarchical forecasting context, where I require reconciled forecasts. I'm not too familiar with the concepts and methods yet, but I was hoping, that also the reconciled prophet-forecasts would have a distribution (as it seems to be the case for ETS() for example), potentially generated via bootstrapping forecast errors.

Is it possible to get a prediction interval for reconciled prophet forecasts? :)

Please finde a reprex below for the approach I have taken so far.

library(tsibble)
library(fable)
library(fable.prophet)
library(dplyr)

tourism_states <- tourism %>%
  aggregate_key(State / Region, Trips = sum(Trips))

mdl <- tourism_states %>% 
  model(prophet = prophet(Trips)) %>% 
  reconcile(prophet_mint = min_trace(prophet, method = "mint_shrink")) %>% 
  select(-prophet)

fc_rec <- mdl %>% 
  forecast(h = "1 year")

fc_rec %>% 
  filter(is_aggregated(State)) %>% 
  autoplot(tourism_states)


fc_rec_b <- mdl %>% 
  forecast(h = "1 year", bootstrap = TRUE)
#> Error: Problem with `mutate()` input `prophet_mint`.
#> x unbenutztes Argument (bootstrap = TRUE)
#> i Input `prophet_mint` is `(function (object, ...) ...`.

fc_rec_b %>% 
  filter(is_aggregated(State)) %>% 
  autoplot(tourism_states)
#> Error in eval(lhs, parent, parent): Objekt 'fc_rec_b' nicht gefunden

Created on 2020-12-10 by the reprex package (v0.3.0)

mitchelloharawild commented 3 years ago

Probabilistic reconciliation is currently only supported for normally distributed forecasts, however is possible to also reconcile the sample paths to give coherent intervals. This will need to be added to {fabletools}.

henningsway commented 3 years ago

Thanks, it's good to know, that this functionality ist not yet available (and that it's not me using the package in the wrong way).

Do you see a way of estimating a normal distribution from the prophet forecast and maybe use this as an input for the reconciliation or some other kind of workaround?