2

I want to calculate .95 prediction interval using auto arima in python .I want to get the standard error of forecast like we can get in stats predict in R.

Then I will use the formula - point forecast ± 1.96 * Standard error of forecast at that time t to get upper and lower bounds.

How can I get the standard error of forecast for this in python. I am using auto arima predict for this. I know that statsmodel forecast has std error parameter to get these but I am using Auto arima predict. Please tell me how can I get the prediction interval for 10 time steps in auto arima? The return Conf interval parameter returns very wide upper and lower range interval. How can I get the standard error of forecasting for arima (1 0 2) order.

vij
  • 21
  • 1
  • 1
  • 4
  • Are you using: https://www.alkaline-ml.com/pmdarima/index.html ? – Ankur Sinha Jul 18 '19 at 14:34
  • Using pmdarima. The built in return confidence interval forecasts .05 alpha are very wide to make sense. – vij Jul 18 '19 at 14:59
  • Anyone can show the manual calculation process for order 1,0,2 arima – vij Jul 18 '19 at 15:04
  • Can anyone help reply please. Need to predict multi step prediction interval for 20 step time period .Using Sarimax model of order 1 0 2 – vij Jul 21 '19 at 14:39

1 Answers1

5

Auto arima works by wrapping statsmodels.tsa.ARIMA and statsmodels.tsa.statespace.SARIMAX together as an estimator. You may extract the results the same way you do it with statsmodels. Here is a sample model:

 model = auto_arima(y_train, start_p=0, start_q=0,
            test='adf',       
            max_p=7, max_q=7, 
            m=np.int(season),             
            d=n_diffs,           
            seasonal=True,  
            start_P=0, 
            D=1, 
            trace=True,
            error_action='ignore',  
            suppress_warnings=True, 
            stepwise=True)

and

print(model.conf_int())

would return you an array with 95 % confidence interval of fitted parameters. Please feel free to go through this documentation SARIMAX results to know more about results of the model.

For 10 step prediction, you may do the following to get the confidence interval:

y_forec, conf_int  = model.predict(10,return_conf_int=True,alpha=0.05)
print(conf_int)

To get model standard error, you may extract the standard error with:

std_error = model.bse()

To get prediction standard error, the confidence intervals shall be used to obtain the standard error. Here is an answer explaining the same: std_err for forecast wiki for standard error and pred interval relation

beginner
  • 144
  • 5
  • Looks correct, the underlying API docs can be found here https://www.alkaline-ml.com/pmdarima/auto_examples/arima/example_auto_arima.html?highlight=conf_int – Paul Lo Oct 30 '19 at 18:15