ARMA.predict的预测间隔

Pet*_*sen 4 python time-series confidence-interval forecasting autoregressive-models

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

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

我猜代码:

from statsmodels.sandbox.regression.predstd import wls_prediction_std
prstd, iv_l, iv_u = wls_prediction_std(results)
Run Code Online (Sandbox Code Playgroud)

在这里找到:模型预测的置信区间

...不适用于OLS,而不适用于ARMA预测。我还检查了github,但没有发现任何可能与时间序列预测有关的新内容。

(我想做出预测需要一定的预测间隔,特别是在样本超标的情况下。)

帮助表示赞赏。

小智 7

我想,对于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)
Run Code Online (Sandbox Code Playgroud)