0

I can't seem to retrieve the components from fable's ETS model running for example:

# data from `tsibble`.
aus_holidays <- tourism %>%
  filter(Purpose == "Holiday") %>%
  summarise(Trips = sum(Trips))

fit <- aus_holidays %>% model(ETS(Trips))

components(fit)

# Error: Problem with `mutate()` input `cmp`. x `levels.yearquarter()` not supported. ℹ Input `cmp` is `map(.fit, components)`.

The error clearly points at a mutate issue with the level's period. And indeed, it works fine with - for example - minute data:

# data from `datasets`.
www_usage <- as_tsibble(WWWusage)

fit <- www_usage %>% model(ETS(value))

components(fit)

# A dable:                   101 x 6 [1]
# Key:                       .model [1]
# ETS(A,Ad,N) Decomposition: value = lag(level, 1) + 0.814958027904187 * lag(slope, 1) +
#   remainder
#   .model     index value level    slope remainder
#   <chr>      <dbl> <dbl> <dbl>    <dbl>     <dbl>
# ...

My question is: how do I retreive fable's ETS components in this case? I might be missing something obvious when running above.

lve
  • 438
  • 5
  • 14

1 Answers1

1

Try updating your packages to the latest CRAN versions of tsibble and fable.

library(tsibble)
library(dplyr)
library(fable)
aus_holidays <- tourism %>%
  filter(Purpose == "Holiday") %>%
  summarise(Trips = sum(Trips))

fit <- aus_holidays %>% model(ETS(Trips))

components(fit)
#> # A dable:                  84 x 6 [1Q]
#> # Key:                      .model [1]
#> # ETS(M,N,M) Decomposition: Trips = lag(level, 1) * lag(season, 4) * (1 +
#> #   remainder)
#>    .model     Quarter  Trips level season remainder
#>    <chr>        <qtr>  <dbl> <dbl>  <dbl>     <dbl>
#>  1 ETS(Trips) 1997 Q1    NA    NA   1.16   NA      
#>  2 ETS(Trips) 1997 Q2    NA    NA   0.968  NA      
#>  3 ETS(Trips) 1997 Q3    NA    NA   0.927  NA      
#>  4 ETS(Trips) 1997 Q4    NA  9667.  0.943  NA      
#>  5 ETS(Trips) 1998 Q1 11806. 9844.  1.16    0.0513 
#>  6 ETS(Trips) 1998 Q2  9276. 9749.  0.968  -0.0269 
#>  7 ETS(Trips) 1998 Q3  8642. 9597.  0.927  -0.0435 
#>  8 ETS(Trips) 1998 Q4  9300. 9692.  0.943   0.0275 
#>  9 ETS(Trips) 1999 Q1 11172. 9665.  1.16   -0.00781
#> 10 ETS(Trips) 1999 Q2  9608. 9757.  0.968   0.0266 
#> # … with 74 more rows

Created on 2020-07-06 by the reprex package (v0.3.0)