简体   繁体   English

如何使用 statsmodels 0.14.0 进行 plot ARIMA 预测/预测

[英]How to plot ARIMA prediction/forecast with statsmodels 0.14.0

In older versions of the python package statsmodels, there was a plot_predict method in the ARIMAResults class.在旧版本的 python package statsmodels 中,ARIMAResults class 中有一个plot_predict方法。 With the new version, there are only forecast , get_forecast , predict and get_prediction methods, but as far as I could see, no built-in plotting method for the results.在新版本中,只有forecastget_forecastpredictget_prediction方法,但据我所知,没有内置的结果绘图方法。

Is there a way to get a similar plot to the one the old plot_predict method generated?有没有办法获得与生成的旧plot_predict方法类似的 plot ?

This code works with statsmodels 0.14.0:此代码适用于 statsmodels 0.14.0:

from statsmodels.graphics.tsaplots import plot_predict从 statsmodels.graphics.tsaplots 导入 plot_predict

fig, ax = plt.subplots(figsize=(10,8))无花果,斧头 = plt.subplots(figsize=(10,8))

ax.plot(pd.DataFrame(train).loc[354:].reset_index(drop=True), '-g', label='observed') ax.plot(pd.DataFrame(train).loc[354:].reset_index(drop=True), '-g', label='observed')

plot_predict(model_fit, start=354, end=365, ax=ax); plot_predict(model_fit, start=354, end=365, ax=ax);

Hint: look up source code and search for plot_predict:提示:查找源代码并搜索 plot_predict:

source code for statsmodels.graphics.tsaplots statsmodels.graphics.tsaplots 的源代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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