0
$\begingroup$

I am using Auto Regression for prediction

Library: statsmodel

Sample Python Code:

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))
print(yhat)

here I am showing an unusual prediction result.

[-7.03558645]

Why does this model predict large -ve number? when I removed the last value from the data it works fine.

$\endgroup$
  • $\begingroup$ Hi. Please, ask this question on Data Science SE and delete it from here because it is off-topic here (questions related to implementation issues are off-topic here). $\endgroup$ – nbro Jun 7 at 13:24
  • $\begingroup$ Thanks for the correction @nbro $\endgroup$ – Majo_Jose Jun 10 at 5:36

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.