简体   繁体   中英

Error: 'ARIMAResults' object has no attribute 'plot_predict'

I'm running this code using sm.tsa.arima.ARIMA on my time series data

model = sm.tsa.arima.ARIMA(df.Sales, order=(1,1,1))
model_fit = model.fit()
print(model_fit.summary())

# Actual vs Fitted
model_fit.plot_predict(dynamic=False)
plt.show()

When I tried to plot the results, it gave me this error:

'ARIMAResults' object has no attribute 'plot_predict'

My version of statsmodels.__version__ is '0.13.2'

Maybe it is the version of statsmodels made that happen. Try to check the version of statsmodels before upgrade the package to 0.6.1

>>> import statsmodels
>>> statsmodels.__version__

 $ pip install statsmodels --upgrade

For more information, click this issue on statsmodels.github

Statsmodels version 13 removed the .plot_predict() method from the ARIMA classes. Hence, you only need to use plot_predict() that you already imported into your code. Here is an example:

plot_predict(model_fit, dynamic=False)
plt.show()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM