繁体   English   中英

时间序列分析/预测

[英]Time Series Analysis / Forecasting

当我尝试使用 AR(3) 模型来预测/预测未来数据时,我得到的预测很差。 我不太确定我哪里出错了,或者为什么预测开始下降。 非常感谢任何帮助或指示。 非常感谢。

这是我的例子:

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)

这些是我的预测值:

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

预测示例图:

在此处输入图像描述

我会发表评论,但还不能。 很少需要澄清。

为什么要使用自动回归模态作为适合线性回归的预测模态? 使用 AR 过程进行预测会引入不稳定性,阶数越高,保持预测稳定就越困难,因为对应于 x[t-1]、x[t-2]、x[t-3] 的每个系数变得更难估计。

暂无
暂无

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

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