简体   繁体   English

时间序列分析/预测

[英]Time Series Analysis / Forecasting

When I try to use an AR(3) model to predict / forecast future data I get a very poor forecast.当我尝试使用 AR(3) 模型来预测/预测未来数据时,我得到的预测很差。 I'm not too sure where I'm going wrong, or why the forecast then begins to decrease.我不太确定我哪里出错了,或者为什么预测开始下降。 More than grateful for any help or pointers.非常感谢任何帮助或指示。 Thank you very much.非常感谢。

Here is my example:这是我的例子:

import pandas as pd

df2 = pd.DataFrame({
     "Month" : [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],
     "Sales Count": [10,15,24,30,33,45,67,70,75,88,92,95,98,105,115]
})

df2.index = df2.Month

df2 = df2.drop('Month',axis=1)

from statsmodels.tsa.arima_model import ARIMA

model = ARIMA(df2['Sales Count'],order=(3,0,0))
model = model.fit()

pred = model.predict(1,27)

These are my predicted values:这些是我的预测值:

  • 1: 10.924977 1:10.924977
  • 2 : 19.647766 2:19.647766
  • 3 : 31.068473 3:31.068473
  • 4 : 35.592394 4:35.592394
  • 5 : 36.422376 5:36.422376
  • 6 : 52.956438 6:52.956438
  • 7 : 81.115237 7 : 81.115237
  • 8 : 74.101817 8 : 74.101817
  • 9 : 77.985398 9:77.985398
  • 10 : 95.468273 10 : 95.468273
  • 11 : 95.013056 11:95.013056
  • 12 : 96.333352 12 : 96.333352
  • 13 : 99.131086 13 : 99.131086
  • 14 : 108.245458 14:108.245458
  • 15 : 120.136458 15:120.136458
  • 16 : 122.627635 16 : 122.627635
  • 17 : 122.961509 17 : 122.961509
  • 18 : 121.735104 18 : 121.735104
  • 19 : 119.397032 19 : 119.397032
  • 20 : 116.308360 20 : 116.308360
  • 21 : 112.751786 21 : 112.751786
  • 22 : 108.946149 22 : 108.946149
  • 23 : 105.057805 23 : 105.057805
  • 24 : 101.210451 24 : 101.210451
  • 25 : 97.493384 25 : 97.493384
  • 26 : 93.968447 26 : 93.968447
  • 27 : 90.675809 27 : 90.675809

Forecast Example Plot:预测示例图:

在此处输入图像描述

I would comment, but can't yet.我会发表评论,但还不能。 Few clarifications are needed.很少需要澄清。

Why are you using an Auto-regressive modal for a prediction modal that's fit for linear regression?为什么要使用自动回归模态作为适合线性回归的预测模态? Predicting using AR processes introduces instability, and the higher the order the more difficult it becomes to keep the predictions stable since each coefficient corresponding to x[t-1], x[t-2], x[t-3] becomes harder to estimate.使用 AR 过程进行预测会引入不稳定性,阶数越高,保持预测稳定就越困难,因为对应于 x[t-1]、x[t-2]、x[t-3] 的每个系数变得更难估计。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM