我正在使用自动回归进行预测
Python示例代码:
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)
我在这里显示异常的预测结果。
[-7.03558645]
为什么这个模型预测大的-ve数?当我从数据中删除最后一个值时,它工作正常。