Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prediction intervals for ARMA.predict

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.

like image 651
Peter Knutsen Avatar asked Jan 06 '15 15:01

Peter Knutsen


People also ask

How do you find the prediction interval?

In addition to the quantile function, the prediction interval for any standard score can be calculated by (1 − (1 − Φµ,σ2(standard score))·2). For example, a standard score of x = 1.96 gives Φµ,σ2(1.96) = 0.9750 corresponding to a prediction interval of (1 − (1 − 0.9750)·2) = 0.9500 = 95%.

What does a 95% prediction interval tell you?

A prediction interval is a range of values that is likely to contain the value of a single new observation given specified settings of the predictors. For example, for a 95% prediction interval of [5 10], you can be 95% confident that the next new observation will fall within this range.

How is Arima prediction interval calculated?

Prediction intervals The first prediction interval is easy to calculate. If ^σ is the standard deviation of the residuals, then a 95% prediction interval is given by ^yT+1|T±1.96^σ y ^ T + 1 | T ± 1.96 σ ^ . This result is true for all ARIMA models regardless of their parameters and orders.

What is prediction interval in forecasting?

Prediction intervals are used to provide a range where the forecast is likely to be with a specific degree of confidence. For example, if you made 100 forecasts with 95% confidence, you would have 95 out of 100 forecasts fall within the prediction interval.


1 Answers

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)
like image 58
Maria Avatar answered Oct 19 '22 09:10

Maria