如何根据季度数据检索“寓言”“ETS”模型的组件?

How do I retrieve the components of a `fable` `ETS` model based on quarterly data?

我似乎无法从 fableETS 模型 运行 中检索组件,例如:

# 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)`.

该错误清楚地指出了关卡周期的变异问题。事实上,它适用于 - 例如 - 分钟数据:

# 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>
# ...

我的问题是:在这种情况下如何检索 fableETS 组件?当上面 运行 时,我可能会遗漏一些明显的东西。

尝试将您的软件包更新到最新的 CRAN 版本的 tsibble 和 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

reprex package (v0.3.0)

于 2020-07-06 创建