我在specials
使用 fable 包进行预测时尝试使用,但我不知道如何使用它们的语法,也找不到可以用作指南的示例。
我在下面放了一个简单的示例,尝试使用带有MEAN预测模型的窗口,但它给了我一个错误。
任何帮助深表感谢!
# Load libraries
library(fable)
#> Warning: package 'fable' was built under R version 3.6.3
#> Loading required package: fabletools
#> Warning: package 'fabletools' was built under R version 3.6.3
library(tsibble)
#> Warning: package 'tsibble' was built under R version 3.6.3
library(tsibbledata)
#> Warning: package 'tsibbledata' was built under R version 3.6.3
library(lubridate)
#> Warning: package 'lubridate' was built under R version 3.6.3
#>
#> Attaching package: 'lubridate'
#> The following object is masked from 'package:tsibble':
#>
#> interval
#> The following objects are masked from 'package:base':
#>
#> date, intersect, setdiff, union
library(dplyr)
#> Warning: package 'dplyr' was built under R version 3.6.3
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:lubridate':
#>
#> intersect, setdiff, union
#> The following object is masked from 'package:tsibble':
#>
#> id
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
# Run example
aus_retail %>%
filter(
State %in% c("New South Wales", "Victoria"),
Industry == "Department stores"
) %>%
model(
snaive = SNAIVE(Turnover),
mean_f = MEAN(Turnover, window(size = 12))
)
#> Error in hasTsp(x): argument "x" is missing, with no default
由reprex 包(v0.3.0)于 2020 年 4 月 23 日创建
sessionInfo()
#> R version 3.6.2 (2019-12-12)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows Server x64 (build 17763)
#>
#> Matrix products: default
#>
#> locale:
#> [1] LC_COLLATE=English_Ireland.1252 LC_CTYPE=English_Ireland.1252
#> [3] LC_MONETARY=English_Ireland.1252 LC_NUMERIC=C
#> [5] LC_TIME=English_Ireland.1252
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] dplyr_0.8.5 lubridate_1.7.8 tsibbledata_0.1.0 tsibble_0.8.6
#> [5] fable_0.1.2 fabletools_0.1.3
#>
#> loaded via a namespace (and not attached):
#> [1] Rcpp_1.0.3 compiler_3.6.2 pillar_1.4.3 highr_0.8
#> [5] tools_3.6.2 digest_0.6.23 evaluate_0.14 lifecycle_0.2.0
#> [9] tibble_3.0.1 gtable_0.3.0 anytime_0.3.7 pkgconfig_2.0.3
#> [13] rlang_0.4.5 yaml_2.2.0 xfun_0.12 stringr_1.4.0
#> [17] knitr_1.27 generics_0.0.2 vctrs_0.2.4 grid_3.6.2
#> [21] tidyselect_1.0.0 glue_1.4.0 R6_2.4.1 rmarkdown_2.1
#> [25] purrr_0.3.4 ggplot2_3.3.0 tidyr_1.0.2 magrittr_1.5
#> [29] scales_1.1.0 ellipsis_0.3.0 htmltools_0.4.0 assertthat_0.2.1
#> [33] colorspace_1.4-1 stringi_1.4.5 munsell_0.5.0 crayon_1.3.4