I am trying to use ETS
function from fable
package (following this tutorial link). Ideally I would like to do it without using tsibble
functionality. In particular I am trying to generate forecast:
library(tsibble)
library(fable)
library(tidyverse)
fit <- ETS(1:63)
forecast(fit, h =2)
returns error:
Error in UseMethod("forecast") :
no applicable method for 'forecast' applied to an object of class "c('mdl_defn', 'R6')"
another try
summary(fit)
also returns error
Error in object[[i]] : wrong arguments for subsetting an environment
So can I used it without full tsibble
functionality? It was so simple with ARIMA from forecast package.
If it is not possible without tsibble
what would be the quickest way to cast it as tsibble
data?
You need to use tsibbles
, but it is very easy to do so.
library(tsibble)
library(fable)
library(tidyverse)
ts(1:63) %>%
as_tsibble() %>%
model(ETS(value)) %>%
forecast(h=2)
#> # A fable: 2 x 4 [1]
#> # Key: .model [1]
#> .model index value .distribution
#> <chr> <dbl> <dbl> <dist>
#> 1 ETS(value) 64 64 N(64, 0)
#> 2 ETS(value) 65 65 N(65, 0)
Created on 2020-02-19 by the reprex package (v0.3.0)