Reputation: 310
I've been trying to use statsmodels' SARIMAX model but return a confidence interval around my predictions.
My goal is to generate series of predictions for the upper and lower bounds of the confidence interval.
I attempted to fit my model, then use get_prediction()
, and finally conf_int()
. get_prediction()
returns data for each of my index as I expected. However, conf_int()
returns a strange matrix:
0 1
ar.S.L7 0.018806 0.194818
ma.S.L7 -0.830238 -0.717128
sigma2 40.832875 48.105937
that I don't understand. I noticed that these are the parameters for a model, but I don't know how to use these to get upper and lower predictions for each of my indices.
I've consulted: this, this, and this, but none of them seem to have the same problem. I've also looked over this question. I have attempted to follow their code as closely as possible, but can't recreate the problem.
Upvotes: 3
Views: 2194
Reputation: 1617
When you do :
model = sm.tsa.statespace.SARIMAX(params)
fit_model = model.fit()
nforecast = 144
forecast = fit_model.get_prediction(end=model.nobs+nforecast)
ci = forecast.conf_int()
print(ci.head())
You should get:
upper [name of your feature] lower [name of your feature]
time1 0.018806 0.194818
time2 -0.830238 -0.717128
time3 40.832875 48.105937
the default headings of ci is just 'upper' and 'lower' if you don't have features headings in your original data.
Upvotes: 2