Correct way to use ARMAResult.predict() function

狂风中的少年 提交于 2019-12-03 06:54:43

You trained the model on a subset of the data and then predict out of sample. AR(MA) prediction quickly converges to the mean of the data. That is why you see the first results. In your second results, you're not doing out of sample forecasting, you're just getting out-of-sample fitted values.

The first few observation data points are fit using the Kalman filter recursions (this is the distinction between full maximum likelihood estimates and conditional maximum likelihood estimates).

I would pick up a good forecasting textbook and review it to understand this behavior.

Another possible and probably shorter solution:

for i in range(0,len(data)):
    fit.append(result.forecast()[0])
    numpy.append(result.data.endog.data[i])
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!