我在使用预测包设置预测参数h = 1
时遇到问题。
示例1
我正在尝试生成here中所述的预测组合。大致按照提供的示例进行操作,我的代码如下:
library(forecast)
y <- AirPassengers
h <- 1
ETS <- forecast(ets(y), h = h)
ARIMA <- forecast(auto.arima(y, lambda = 0, biasadj = TRUE), h = h)
STL <- stlf(y, lambda = 0, h = h, biasadj = TRUE)
NNAR <- forecast(nnetar(y), h = h)
TBATS <- forecast(tbats(y, biasadj = TRUE), h = h)
Combination <- (ETS[["mean"]] + ARIMA[["mean"]] + STL[["mean"]] +
NNAR[["mean"]] + TBATS[["mean"]]) / 5
NextMethod(.Generic)中的错误:无法将'tsp'分配给零长度 向量另外:警告消息:在.cbind.ts(list(e1,e2)中, c(deparse(substitute(e1))[1L],deparse(substitute(e2))[1L]),:
不相交的系列
示例2
在各种参数设置下,与其他数据集分别运行stlf()
函数:
library(fpp2)
# stlf(fpp2::debitcards, h = 1, lambda = NULL, biasadj = FALSE) # works
# stlf(fpp2::debitcards, h = 1, lambda = NULL, biasadj = TRUE) # works
# stlf(fpp2::debitcards, h = 1, lambda = 0, biasadj = FALSE) # works
stlf(fpp2::debitcards, h = 1, lambda = 0, biasadj = TRUE) # does not work
NextMethod(.Generic)中的错误:无法将'tsp'分配给零长度 向量另外:警告消息:在.cbind.ts(list(e1,e2)中, c(deparse(substitute(e1))[1L],deparse(substitute(e2))[1L]),:
不相交的系列
我正在使用预测版本8.5。我的sessionInfo()
输出:
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=Swedish_Sweden.1252 LC_CTYPE=Swedish_Sweden.1252 LC_MONETARY=Swedish_Sweden.1252 LC_NUMERIC=C LC_TIME=Swedish_Sweden.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] fpp2_2.3 expsmooth_2.3 fma_2.3 ggplot2_3.0.0 forecast_8.5 RevoUtils_11.0.1 RevoUtilsMath_11.0.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.18 urca_1.3-0 pillar_1.3.0 compiler_3.5.1 plyr_1.8.4 bindr_0.1.1 xts_0.11-0 tseries_0.10-45 tools_3.5.1 nlme_3.1-137
[11] tibble_1.4.2 gtable_0.2.0 lattice_0.20-35 pkgconfig_2.0.1 rlang_0.2.1 rstudioapi_0.7 curl_3.2 yaml_2.2.0 parallel_3.5.1 bindrcpp_0.2.2
[21] withr_2.1.2 dplyr_0.7.6 knitr_1.20 lmtest_0.9-36 grid_3.5.1 nnet_7.3-12 tidyselect_0.2.4 glue_1.3.0 R6_2.2.2 TTR_0.23-3
[31] purrr_0.2.5 magrittr_1.5 scales_0.5.0 quantmod_0.4-13 assertthat_0.2.0 timeDate_3043.102 colorspace_1.3-2 fracdiff_1.4-2 quadprog_1.5-5 lazyeval_0.2.1
相关问题here。