Prediction intervals for ARMA.predict
Asked Answered
F

1

6

The Summary of an ARMA prediction for time series (print arma_mod.summary()) shows some numbers about the confidence interval. Is it possible to use these numbers as prediction intervals in the plot which shows predicted values?

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

I guess the code:

from statsmodels.sandbox.regression.predstd import wls_prediction_std
prstd, iv_l, iv_u = wls_prediction_std(results)

found here: Confidence intervals for model prediction

...does not apply here as it is made for OLS rather then for ARMA forecasting. I also checked github but did not find any new stuff which might relate to time series prediction.

(Making forecasts requires forecasting intervals i guess, especially when it comes to an out-of sample forecast.)

Help appreciated.

Farhi answered 6/1, 2015 at 15:3 Comment(0)
E
9

I suppose, for out-of-sample ARMA prediction, you can use ARMA.forecast from statsmodels.tsa

It returns three arrays: predicted values, standard error and confidence interval for the prediction.

Example with ARMA(1,1), time series y and prediction 1 step ahead:

import statsmodels as sm
arma_res = sm.tsa.ARMA(y, order=(1,1)).fit()
preds, stderr, ci = arma_res.forecast(1)
Extract answered 19/5, 2015 at 14:29 Comment(3)
Looks like that method is available for ARIMA models as well. statsmodels.sourceforge.net/devel/generated/…Redistrict
Does anyone have any resources of how they calculate the confidence interval? Is it simply using the standard deviation of the data?Redistrict
import statsmodels.api as sm instead of import statsmodels as smShornick

© 2022 - 2024 — McMap. All rights reserved.