【发布时间】:2015-08-08 17:02:40
【问题描述】:
抱歉,如果这是一个简单的问题/错误,但是当我尝试使用 statsmodels.tsa AR 预测时间序列时,预测会很快超过我拥有的数据。这不取决于模型的顺序或用于拟合 AR 模型的数据长度。
我做错了什么?
from statsmodels.tsa.ar_model import AR
section1 = data[0:800]-np.mean(data[0:800])
plt.plot(section1)
x = AR(section1)
y = x.fit(5)
z = y.predict(10,1500)
plt.plot(z)
【问题讨论】:
-
您知道回归模型如何尝试拟合您的数据吗?您在 0-800 范围内的预测数据看起来像是直接取自您的训练集。
-
是的,我认为前 800 个是训练集 - 在 Ar fit() 的文档字符串中“返回样本内和样本外预测”。我希望样本外在 800 之前继续,而不是收敛到平均值,
标签: python time-series statsmodels autoregressive-models