简体   繁体   English

Python statsmodels arima 预测结果

[英]Python statsmodels arima predict result

I'm trying to understand predict result from statmodels ARIMA in Python.我试图了解 Python 中 statmodels ARIMA 的预测结果。

I fitted data to the model and made a prediction.我将数据拟合到模型中并进行了预测。

model = ARIMA(ts, order = (1,1,1))
model_fit = model.fit(disp=0)
yhat = model_fit.predict()

But the yhat looks very different from original data.但是 yhat 看起来与原始数据非常不同。 The blue line is predicted value while the red is original time series.蓝线是预测值,红线是原始时间序列。
在此处输入图片说明

Although the model fit was poor, I expected blue line would appear nearby the red.虽然模型拟合很差,但我预计蓝线会出现在红色附近。 But in the plot above, the blue line had completely different ranges than original series.但在上图中,蓝线的范围与原始系列完全不同。 Most of all, the value looked like a difference.最重要的是,价值看起来有所不同。

So I experimentally subtracted the value from original time series, then drew the same plot.所以我通过实验从原始时间序列中减去该值,然后绘制相同的图。 The blue line represents values subtracting the predicted result from original series while the red is original.蓝线表示从原始系列中减去预测结果的值,而红色是原始值。 It looked much more promising.它看起来更有希望。

在此处输入图片说明

But is it really correct to use predicted values from model.fit.predict() like this?但是像这样使用来自 model.fit.predict() 的预测值真的正确吗? I was wondering if it makes sense?我想知道这是否有意义? If not, what is correct way to interpret predicted values?如果不是,那么解释预测值的正确方法是什么?

尝试:

yhat = model_fit.predict(start = start, end = end, typs = 'levels')

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

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