I am using autoregression for predicting next 10 steps ahead, but if I am giving more than 8 input values, it predicts negative value, otherwise the prediction is good. What is the reason behind it?

The code is like:

from statsmodels.tsa.ar_model import AR
from random import random
# contrived dataset
data =[0.394,0.428,0.49,0.594,0.75,0.656,0.673,0.731,0.743,0.837,0.838,0.896,1.014,1.003,1.01,1.101,1.097]
# fit model
model = AR(data)
model_fit = model.fit()
# make prediction
yhat = model_fit.predict(len(data), len(data))

The result:[-7.03558645]

  • $\begingroup$ Although I have worked with it I am not an ARIMA expert, but the answer to your question clearly is that your model believes based on past events at some point the results will be negative. That is one reason that damptrend models were created. At some point a trend can generate nonsensical results. This is an issue with time series generally not just ARIMA. It is why data analyst have to use their judgement. $\endgroup$ – user54285 Jun 10 at 23:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.