3

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.

Community
  • 1
  • 1
BBischof
  • 310
  • 2
  • 13
  • 1
    `conf_int` means different things depending on which statistic is refers to. `conf_int` of a model results instance are the confidence intervals for the estimated parameters. `conf_int` in a prediction or forecast are either prediction intervals for a new observation or confidence interval for the expected value of a new observation. – Josef Jan 06 '17 at 00:11

1 Answers1

2

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.

wi3o
  • 1,467
  • 3
  • 17
  • 29