When using aTSA and Forecast Packages together forecast() function and Arima() gives error

感情迁移 提交于 2021-01-29 18:57:20

问题


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.

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

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"))

回答1:


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.

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.



来源:https://stackoverflow.com/questions/60800874/when-using-atsa-and-forecast-packages-together-forecast-function-and-arima-g

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!