0

问题

我正在尝试使用具有 ARIMA 错误的回归模型来生成预测,但它们总是无法生成NULL模型以外的任何东西;相反,TSLM模型在相同的数据上工作得很好。

在寻找答案时,我发现了这个关于将模型应用于多个时间序列的问题,并试图重现Rob Hyndman的示例(将代码复制粘贴到 rstudio 云中)。

它没有用(详情如下)。

怎么了?

代码

library(tidyverse)
library(tsibble)
library(fable)
library(lubridate)
set.seed(1)
ar1  <-  arima.sim(model=list(ar=.6), n=30)
ma1 <- arima.sim(model=list(ma=0.4), n=30)
Date  <- ymd(paste0("2019-01-",1:30))
tb <- bind_cols(Date=Date, ar1=ar1, ma1=ma1) %>%
        gather("Series", "value", -Date) %>%
        as_tsibble(index=Date, key=Series)
tb
tb_all <- tb %>% model(arima = ARIMA(value))
tb_all

输出

# A mable: 2 x 2
# Key:     Series [2]
  Series arima       
  <chr>  <model>     
1 ar1    <NULL model>
2 ma1    <NULL model>

会话信息(在 rstudio 云上)

R version 4.0.0 (2020-04-24)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/atlas-base/atlas/libblas.so.3.0
LAPACK: /usr/lib/atlas-base/atlas/liblapack.so.3.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
 [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
[10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] lubridate_1.7.8  gridtext_0.1.1   ggtext_0.1.0     forcats_0.5.0    stringr_1.4.0   
 [6] dplyr_0.8.5      purrr_0.3.4      tidyr_1.1.0      tibble_3.0.1     ggplot2_3.3.0   
[11] tidyverse_1.3.0  patchwork_1.0.0  zoo_1.8-8        tsibble_0.8.6    feasts_0.1.3    
[16] fable_0.2.0      fabletools_0.1.3 janitor_2.0.1    eurostat_3.6.1   scales_1.1.1    
[21] readr_1.3.1      here_0.1         devtools_2.3.0   usethis_1.6.1    pacman_0.5.1    

loaded via a namespace (and not attached):
 [1] nlme_3.1-147       fs_1.4.1           sf_0.9-3           RColorBrewer_1.1-2
 [5] httr_1.4.1         rprojroot_1.3-2    tools_4.0.0        backports_1.1.7   
 [9] utf8_1.1.4         R6_2.4.1           KernSmooth_2.23-16 DBI_1.1.0         
[13] colorspace_1.4-1   withr_2.2.0        sp_1.4-2           tidyselect_1.1.0  
[17] prettyunits_1.1.1  processx_3.4.2     curl_4.3           compiler_4.0.0    
[21] rvest_0.3.5        cli_2.0.2          xml2_1.3.2         desc_1.2.0        
[25] classInt_0.4-3     callr_3.4.3        digest_0.6.25      pkgconfig_2.0.3   
[29] bibtex_0.4.2.2     sessioninfo_1.1.1  dbplyr_1.4.4       rlang_0.4.6       
[33] readxl_1.3.1       rstudioapi_0.11    generics_0.0.2     jsonlite_1.6.1    
[37] magrittr_1.5       Rcpp_1.0.4.6       munsell_0.5.0      fansi_0.4.1       
[41] RefManageR_1.2.12  lifecycle_0.2.0    stringi_1.4.6      snakecase_0.11.0  
[45] pkgbuild_1.0.8     plyr_1.8.6         grid_4.0.0         blob_1.2.1        
[49] slider_0.1.3       crayon_1.3.4       lattice_0.20-41    haven_2.3.0       
[53] hms_0.5.3          knitr_1.28         anytime_0.3.7      ps_1.3.3          
[57] pillar_1.4.4       pkgload_1.0.2      reprex_0.3.0       glue_1.4.1        
[61] remotes_2.1.1      modelr_0.1.8       vctrs_0.3.0        cellranger_1.1.0  
[65] testthat_2.3.2     gtable_0.3.0       assertthat_0.2.1   xfun_0.14         
[69] broom_0.5.6        countrycode_1.2.0  e1071_1.7-3        class_7.3-16      
[73] warp_0.1.0         memoise_1.1.0      units_0.6-6        ellipsis_0.3.1    
4

1 回答 1

1

手动安装包urca

于 2020-05-30T20:07:55.693 回答