【问题标题】:Prediction intervals for ARMA.predictARMA.predict 的预测区间
【发布时间】:2015-05-19 22:29:29
【问题描述】:

时间序列的 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,但没有发现任何可能与时间序列预测有关的新内容。

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

帮助表示赞赏。

【问题讨论】:

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


    【解决方案1】:

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

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

    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)
    

    【讨论】:

    • 看起来该方法也可用于 ARIMA 模型。 statsmodels.sourceforge.net/devel/generated/…
    • 有没有人知道他们如何计算置信区间?是单纯的使用数据的标准差吗?
    • import statsmodels.api as sm 而不是 import statsmodels as sm
    猜你喜欢
    • 2015-03-11
    • 1970-01-01
    • 2013-07-07
    • 2015-04-30
    • 2017-11-10
    • 2020-05-10
    • 2021-01-22
    • 2021-01-22
    • 1970-01-01
    相关资源
    最近更新 更多