0

我似乎无法从运行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>
# ...

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

4

1 回答 1

1

尝试将您的软件包更新到最新的 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 包于 2020-07-06 创建(v0.3.0)

于 2020-07-06T01:42:24.040 回答