Auto Regression Predicting large negative number

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.

• 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). – nbro Jun 7 at 13:24
• Thanks for the correction @nbro – Majo_Jose Jun 10 at 5:36