【发布时间】:2024-01-20 04:06:01
【问题描述】:
从这个ts:
australia_data <- tourism %>%
select(Quarter, Trips) %>%
summarise(TotalTrips = sum(Trips))
> head(australia_data)
# A tsibble: 6 x 4 [1D]
# Key: Region, Purpose [1]
# Groups: Region [1]
Region Purpose Quarter TotalTrips
<chr> <chr> <date> <dbl>
1 Adelaide Business 1998-01-01 135.
2 Adelaide Business 1998-04-01 110.
3 Adelaide Business 1998-07-01 166.
4 Adelaide Business 1998-10-01 127.
5 Adelaide Business 1999-01-01 137.
6 Adelaide Business 1999-04-01 200.
我想做一个 STL 分解,以获得季节性调整的数据:
australia_data_dcmp <- australia_data %>%
model(STL(TotalTrips))
但我无法获取组件
> components(australia_data_dcmp)
Error: Problem with `mutate()` column `cmp`.
i `cmp = map(.fit, components)`.
x no applicable method for 'components' applied to an object of class "null_mdl"
> head(augment(australia_data_dcmp))
# A tsibble: 6 x 8 [1D]
# Key: Region, Purpose, .model [1]
Region Purpose .model Quarter TotalTrips .fitted .resid .innov
<chr> <chr> <chr> <date> <dbl> <dbl> <dbl> <dbl>
1 Adelaide Business STL(TotalTrips) 1998-01-01 135. NA NA NA
2 Adelaide Business STL(TotalTrips) 1998-04-01 110. NA NA NA
3 Adelaide Business STL(TotalTrips) 1998-07-01 166. NA NA NA
4 Adelaide Business STL(TotalTrips) 1998-10-01 127. NA NA NA
5 Adelaide Business STL(TotalTrips) 1999-01-01 137. NA NA NA
6 Adelaide Business STL(TotalTrips) 1999-04-01 200. NA NA NA
谁能解释一下我所犯的错误?
最好的问候
【问题讨论】:
-
似乎无法重现您的问题。它在我这边工作得很好。你是加载 fpp3 包还是只加载 fable 和 fabletools?
-
fpp3,类似情况已经不是第一次了
-
已经卸载并重新安装了软件包,情况仍然存在@phiver
-
同样的情况持续存在
-
重启并尝试:
library(fable) library(feasts) library(dplyr) data("tourism", package = "tsibble")然后你的代码。如果这不起作用,请在没有 Rstudio 的情况下启动 R 并尝试此操作。
标签: r stl time-series decomposition