R语言调用ets()函数处理时间序列时运行无响应卡死问题解决
R调用ets()函数卡死崩溃问题及解决方案
问题描述
处理时间序列数据时调用R的ets()函数,运行后程序无响应无法结束,甚至会导致R崩溃需要重启。经测试,确认可正常运行的课程示例代码运行后也出现相同问题,但同一份时间序列数据调用auto.arima()等其他函数可以正常运行。
可复现信息
测试用时间序列数据
data_ts Time Series: Start = c(3, 5) End = c(18, 2) Frequency = 7 [1] 152 100 54 199 166 143 162 116 136 68 176 181 120 141 205 118 62 152 135 180 172 180 82 96 193 209 146 189 [29] 170 94 67 182 201 186 223 187 96 70 156 220 214 160 180 114 76 194 176 141 194 153 102 128 193 185 173 169 [57] 171 95 80 137 147 163 183 165 78 88 169 172 169 190 123 76 50 147 126 159 172 162 92 79 99 125 171 182 [85] 185 98 50 151 188 148 165 167 96 86 244 173 127 124 151 134 96 138 244
运行代码
data_ts.ets1 <- ets(data_ts, model = "ANA")
也尝试过默认model = "ZZZ"参数,问题依旧存在。
前期排查信息
- 首次运行
ets()函数时控制台会返回No model able to be fitted,第二次运行就会出现卡死无响应的情况,本应正常拟合模型的示例代码也出现相同问题。 - 尝试使用
forecast::ets指定包名调用函数,问题未解决,初步检查未发现导入的包存在版本过时问题。 - 运行环境信息如下:
sessionInfo() R version 4.0.3 (2020-10-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19042) Matrix products: default locale: [1] LC_COLLATE=Spanish_Argentina.1252 LC_CTYPE=Spanish_Argentina.1252 LC_MONETARY=Spanish_Argentina.1252 [4] LC_NUMERIC=C LC_TIME=Spanish_Argentina.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] forecast_8.15 devtools_2.4.2 usethis_2.1.3 ggplot2_3.3.5 dplyr_1.0.7 tseries_0.10-48 loaded via a namespace (and not attached): [1] Rcpp_1.0.6 lattice_0.20-41 prettyunits_1.1.1 ps_1.5.0 zoo_1.8-8 rprojroot_2.0.2 [7] assertthat_0.2.1 digest_0.6.25 lmtest_0.9-38 utf8_1.1.4 R6_2.5.1 evaluate_0.14 [13] pillar_1.6.4 rlang_0.4.12 curl_4.3 fracdiff_1.5-1 callr_3.7.0 TTR_0.24.2 [19] rmarkdown_2.6 desc_1.4.0 labeling_0.4.2 stringr_1.4.0 munsell_0.5.0 compiler_4.0.3 [25] xfun_0.18 pkgconfig_2.0.3 pkgbuild_1.2.0 urca_1.3-0 htmltools_0.5.0 nnet_7.3-14 [31] tidyselect_1.1.0 tibble_3.0.3 quadprog_1.5-8 fansi_0.4.2 crayon_1.4.2 withr_2.4.2 [37] grid_4.0.3 nlme_3.1-149 jsonlite_1.7.2 gtable_0.3.0 lifecycle_1.0.1 DBI_1.1.1 [43] magrittr_2.0.1 scales_1.1.1 quantmod_0.4.18 cli_3.1.0 stringi_1.5.3 cachem_1.0.6 [49] farver_2.0.3 remotes_2.4.1 fs_1.5.0 testthat_3.1.0 timeDate_3043.102 ellipsis_0.3.2 [55] xts_0.12.1 generics_0.1.0 vctrs_0.3.8 tools_4.0.3 glue_1.4.2 purrr_0.3.4 [61] pkgload_1.2.3 processx_3.5.2 parallel_4.0.3 fastmap_1.1.0 yaml_2.2.1 colorspace_1.4-1 [67] sessioninfo_1.2.1 memoise_2.0.0 knitr_1.30
最终解决方案
更新RStudio中所有已安装的过期包(不止forecast等预先导入的包)后,该问题成功修复。
内容的提问来源于stack exchange,提问作者Hernan
相关产品推荐
相关产品推荐

