本文介绍了当同时使用aTSA和Forecast Packages时,Forecast()函数和Arima()会出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试同时使用aTSA和Forecast软件包,并注意到Arima()函数可以工作,但是Forecast()给出了错误.有没有人对此有解决方案或遇到过这种情况?我特别尝试使用aTSA中的Static.test(),这就是我调用该库的主要原因.

I have been trying to use aTSA and Forecast package together and noticed that the Arima() function works but the forecast() give error. Does anyone have a solution for this or encountered this? I am especially trying to use stationary.test() from aTSA and that was the main reason I called the library.

错误:预测(.)中的错误:对象"应该是根据arima()或estimate()估算出的"Arima"或"estimate"类

error: Error in forecast(.) : 'object' should be 'Arima' or 'estimate' class estimated from arima() or estimate()

我删除aTSA后,上面的方法就起作用了.

As soon as I removed aTSA, the above worked.

fitArima_CO <- Arima(train_CO, order=c(4,1,1))

  fit_CO %>%
    forecast() %>%
    autoplot() + 
    autolayer(test_CO, colour = TRUE, series = 'Test Data') +
    ylab("Adjusted CO") + 
    guides(colour=guide_legend(title = "Data Series"), fill=guide_legend(title = "Prediction Interval")) +
    scale_color_manual(values=c("gold"))

推荐答案

不幸的是, aTSA 包不能与其他时间序列包很好地配合使用.特别是,其 forecast()函数将从 forecast 包中覆盖 forecast()函数.

Unfortunately the aTSA package does not play nicely with other time series packages. In particular, its forecast() function will overwrite the forecast() function from the forecast package.

默认情况下, stationarity.test()函数将执行ADF测试.您可以使用 tseries 包中的 adf.test()轻松地执行相同的测试.

The stationarity.test() function will do an ADF test by default. You can easily do the same test using the adf.test() from the tseries package.

这篇关于当同时使用aTSA和Forecast Packages时,Forecast()函数和Arima()会出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 11:17