python - ARMA.predict 的预测区间

标签 python time-series forecasting confidence-interval autoregressive-models

时间序列的 ARMA 预测摘要 ( print arma_mod.summary() ) 显示了一些关于置信区间的数字。是否可以将这些数字用作显示预测值的图中的预测区间?

ax = indexed_df.ix[:].plot(figsize=(12,8))
ax = predict_price.plot(ax=ax, style='rx', label='Dynamic Prediction');
ax.legend(); 

我猜代码:
from statsmodels.sandbox.regression.predstd import wls_prediction_std
prstd, iv_l, iv_u = wls_prediction_std(results)

在这里找到:Confidence intervals for model prediction

...在这里不适用,因为它是为 OLS 而不是 ARMA 预测制作的。我还检查了 github,但没有找到任何可能与时间序列预测有关的新东西。

(我猜预测需要预测间隔,尤其是在样本外预测时。)

帮助表示赞赏。

最佳答案

我想,对于样本外 ARMA 预测,您可以使用 ARMA.forecast来自 statsmodels.tsa

它返回三个数组:预测值、标准误差和预测的置信区间。

ARMA(1,1) 示例,时间序列 y 和预测提前 1 步:

import statsmodels as sm
arma_res = sm.tsa.ARMA(y, order=(1,1)).fit()
preds, stderr, ci = arma_res.forecast(1)

关于python - ARMA.predict 的预测区间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27801357/

相关文章:

python - 如何为 Pandas 时间序列制作动画?

sql-server - SQL Server : time-series data performance

python - 使用 statsmodels 进行 ARMA 样本外预测

r - 每 15 分钟使用数据创建时间序列模型

python - 在 Windows 上使用现有 Python 发行版安装 QuTIP 2.2.0

python - 使用 TensorFlow.js 模型转换器的 Keras 转换模型。 : error: unrecognized arguments:\folder

python - 计算python中单词中字母之间的距离

python - 时间序列的 seq2seq 预测

r - 使用 dplyr 按名称从列表中提取

javascript - 使用 Cocos2d-JS 在 Django 应用程序中加载 .js 文件时出错