简体   繁体   中英

Python statsmodels arima predict result

I'm trying to understand predict result from statmodels ARIMA in Python.

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. 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? 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')

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