简体   繁体   English

Autoplot 仅使用 R 中的时间序列寓言绘制 ETS 的预测

[英]Autoplot plots ONLY the forecast for ETS using fable for time series in R

I've been playing around with forecast, fable, and tibble, and was working through Rob Hyndman's examples HERE .我一直在玩弄预测,寓言,和tibble,并通过罗布海德门的例子正在这里 When I get to the end of the "auscafe" example, the autoplot that comes out is ONLY for the forecast, not the original plot PLUS the forecast as shown (and expected).当我结束“auscafe”示例时,出现的自动绘图仅用于预测,而不是原始绘图加上所示(和预期)的预测。

What am I missing here?我在这里缺少什么?

library(fpp2)
library(tsibble)
library(fable)
data("auscafe")

# Make auscafe a tsibble and confirm 
cafe <- as_tsibble(auscafe)
cafe


# Take a look
autoplot(cafe)

# ETS model noodling after Hyndman's 2018 presentation  
# https://robjhyndman.com/seminars/isf-fable/

cafe %>% ETS(value) %>% summary

cafe %>% ETS(value) %>% forecast() %>% summary()

cafe %>% ETS(value) %>% forecast() %>% summary(level=90)

# See Hyndman slide 11: He gets the original series PLUS the forecast
# When I run this, I get a plot of ONLY the forecast, 
# i.e., 2008-07 to 2010-07

cafe %>% ETS(value) %>% forecast() %>% autoplot()

I also posted this on the tidyverts/fable git repo and got this excellent response from Mitchell O'Hara-Wild:我还在 tidyverts/fable git repo 上发布了这篇文章,并得到了 Mitchell O'Hara-Wild 的出色回应:

Since the presentation the package has undergone several changes as we figure out the best way to implement the features.自介绍以来,随着我们找出实现这些功能的最佳方式,该包经历了多次更改。

At the time of the presentation, the fable package was simply a wrapper to the forecast package, and so fable::ARIMA would call forecast::auto.arima.在演示时,fable 包只是预测包的包装器,因此 fable::ARIMA 将调用 forecast::auto.arima。 Since then, the ARIMA method has been re-implemented from scratch, and as the error states, currently does not support selection of differences.从那以后,ARIMA 方法从头开始重新实现,并且作为错误状态,目前不支持差异选择。 For now, the order of integration must be specified with model specials.目前,集成顺序必须与模型特价一起指定。 For example, pdq(d=1) + PDQ(D=1) would include both a seasonal and non-seasonal difference.例如,pdq(d=1) + PDQ(D=1) 将包括季节性和非季节性差异。 This functionality will be added in the near future.此功能将在不久的将来添加。

We've also changed how forecasts work.我们还改变了预测的工作方式。 Forecasts now contain only future predicted values, and so the data used to train the model is no longer included.预测现在只包含未来的预测值,因此不再包含用于训练模型的数据。 The historical data for the forecasts can be included by providing the data as the first argument to autoplot.通过提供数据作为 autoplot 的第一个参数,可以包含预测的历史数据。

prison %>% ETS(count) %>% forecast() %>% autoplot(prison)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM