我正在尝试从生成的预测模型中获取样本fable
。这是我尝试过的
library(fable)
library(tsibble)
library(tsibbledata)
library(dplyr)
library(tidyr)
# Forecasting with an ETS(M,Ad,A) model to Australian beer production
beer_fc <- aus_production %>%
model(ets = ETS(log(Beer) ~ error("M") + trend("Ad") + season("A"))) %>%
forecast(h = "3 years", bootstrap=TRUE, times = 5)
beer_fc %>% unnest(c(Beer))
我得到的错误是:
Error: Input must be list of vectors
这是数据的结构str(beer_fc$Beer[1])
:
> str(beer_fc$Beer[1])
dist [1:1]
$ :List of 3
..$ dist :List of 1
.. ..$ x: num [1:5] 6.09 6.02 6.06 6 5.95
.. ..- attr(*, "class")= chr [1:2] "dist_sample" "dist_default"
..$ transform:function (.x)
.. ..- attr(*, "class")= chr "transformation"
.. ..- attr(*, "inverse")=function (.x)
..$ inverse :function (.x)
..- attr(*, "class")= chr [1:2] "dist_transformed" "dist_default"
@ vars: chr "Beer"