问题
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