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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With