letgo
letgo

Reputation: 21

different result from model_fit.plot_predict() and model_fit.predict() from arima

I want to know how arima works well by using difference between predict value and real value. So I used predict()(the below one) but it is different from the value of plot_predict()(above one). (please look how it is different) enter image description here I think plot_predict values are what I want, since it is closer to the real values but what I can get from predict() is so low. Please help me to find the answer. Appreciate for your help.

For the first one, I used

from statsmodels.tsa.arima_model import ARIMA

model = ARIMA(sales, order=(0,1,1))
model_fit = model.fit(trend='nc',full_output=True, disp=1)
print(model_fit.summary())
model_fit.plot_predict(dynamic=False)

for the below one, I used

predict=model_fit.predict()
plt.plot(predict) 

Upvotes: 2

Views: 2023

Answers (1)

Which version of statsmodels do you use?

I think you are using statsmodels version 10.2 (which is currently a default version of statsmodels in Google Colab)

Pay attention to the typ parameter in the function (described in this link) and change the value into levels to get the prediction value instead of differenced value.

predict=model_fit.predict(typ='levels')
plt.plot(predict)
plt.plot(sales)

Upvotes: 1

Related Questions