ARIMA预测的统计模型为我提供了差分信号的预测,而不是实际信号的预测.我犯什么错误? [英] statsmodels ARIMA predict is giving me predictions of the differenced signal instead of predictions of the actual signal. What mistake am I making?

查看:127
本文介绍了ARIMA预测的统计模型为我提供了差分信号的预测,而不是实际信号的预测.我犯什么错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

信号看起来像这样

原始信号

使用 plot(output.diff())获得的差分信号看起来像这样

The differenced signal obtained by using plot(output.diff()) looks as such

差分信号

接下来,通过分析ACF和PACF获得ARIMA模型的参数

Next the parameters of the ARIMA model were obtained by analyzing the ACF and PACF

模型通过以下方式拟合

模型= ARIMA(输出值,顺序=(2,1,1))

model_fit = model.fit(disp = 0)

当我使用

model_fit.plot_predict(dynamic = False)

plt.show()

太完美了!

使用plot_predict的结果

但是当我使用 plt.plot(model_fit.predict(dynamic = False))

它给出了差分信号的预测

It gives a predictions of the differenced signal

使用Arima预测结果

推荐答案

如果使用模型 sm.tsa.ARIMA ,则可以使用以下代码:

If you are using the model sm.tsa.ARIMA, then you can use the following:

plt.plot(model_fit.predict(dynamic=False, typ='levels'))

但是,此模型已弃用,并将在将来的Statsmodels版本中删除.为了与将来的版本兼容,您可以使用新的ARIMA模型:

However, this model is deprecated and will be removed in future Statsmodels versions. For compatibility with future versions, you can use the new ARIMA model:

ARIMA

import statsmodels.api as sm

model = sm.tsa.arima.ARIMA(output.values, order=(2,1,1))

此新模型将自动生成实际信号的预测和预测,因此在这种情况下,您无需使用 typ ='levels'.

This newer model will automatically produce forecasts and predictions of the actual signal, so you do not need to use typ='levels' in this case.

这篇关于ARIMA预测的统计模型为我提供了差分信号的预测,而不是实际信号的预测.我犯什么错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆