首页 > 解决方案 > 添加带有寓言预测估计的 theta 模型

问题描述

我想Forecast在我的fable预测模型中使用包中实现的 theta 模型。这就是我想要做的。

library(forecast)
library(tidyverse)
library(fable)
library(tsibble)
library(fabletools)

tourism_aus <- tourism %>% 
  summarise(Trips = sum(Trips))
tourism_aus


fit <- tourism_aus %>% 
  model(
    ets = ETS(Trips),
    arima = ARIMA(Trips),
    theta = forecast::thetaf(Trips)
  ) %>% 
  mutate(
    average = (ets + arima + theta) / 3
  )
fit

fit %>% 
  forecast(h = "2 years") %>% 
  autoplot(tourism_aus, level = 95, alpha = 0.5)

我收到此错误消息,

Failure in thetaf(Trips) : Objekt 'Trips' not found

有什么办法可以在里面使用theta方法fable吗?

标签: rforecastfable-r

解决方案


预测包中的模型使用不同的接口,因此与model()fable 使用的函数不兼容。theta 模型将在下一个版本中添加到 fable 中。

您可以自己创建寓言,使用 的预测输出forecast::thetaf()来确定适当的分布。这对于绘图、准确性评估和协调很有用,但是集成需要模型使用 fable 接口。

更新:该THETA()模型现已添加到寓言中。


推荐阅读