forecast and fable return different outputs on same dataset for forecasting in R

泄露秘密 提交于 2021-02-10 05:36:06

问题


I am trying to understand the different between two forecasting package forecast and fable, as the two editions of the same book (second edition and third edition seems to imply that the two packages are equivalent.

library(dplyr)

raw <- c(44.4082519001086, 47.1074380165289, 43.5633367662204, 43.1003584229391, 
         42.5828970331588, 38.3217993079585, 38.5751520417029)
# raw <- c(raw,rev(raw))

forecast.df <- ts(raw)
forecast::autoplot(forecast.df) +
  forecast::autolayer(forecast::holt(forecast.df,damped=FALSE,h = 5),
                      series="Holt's method",PI = TRUE)


fable.df <- tsibble::as_tsibble(tibble(value=raw) %>%
                                 mutate(time=1:n()),index=time)
fable.df %>%
  fabletools::model(`Holt's method`=
                      fable::ETS(value ~ error("A") + trend("A") + season("N"))) %>%
  fabletools::forecast(.,h=5) %>%
  fabletools::autoplot(fable.df,level=c(80,95))

By eyeballing the two charts, the boundaries of prediction interval generated by fabletools are parallel, compared with those generated by forecast being in funnel shape.

I am not sure if I have missed some parameters when setting up forecast or fable. Thanks!

来源:https://stackoverflow.com/questions/64854538/forecast-and-fable-return-different-outputs-on-same-dataset-for-forecasting-in-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!