Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

statsmodels.tsa.ar_model.ARResults.predict #1651

Closed
eoseubert opened this issue Apr 30, 2014 · 9 comments

Comments

Projects
None yet
4 participants
@eoseubert
Copy link

commented Apr 30, 2014

Hi,

I don't believe that the confint parameter is being implemented in http://statsmodels.sourceforge.net/devel/generated/statsmodels.tsa.ar_model.ARResults.predict.html

ARResults.predict(start=None, end=None, dynamic=False)

@jseabold

This comment has been minimized.

Copy link
Member

commented Apr 30, 2014

Ah, yes. Good catch. That's a docs issue. We can add that though. If you do need confidence intervals for forecasts, you can use the forecast method of the ARMA model. See also #1563 for upcoming addition of a plotting method for prediction in AR(IMA) models.

@jseabold jseabold added this to the 0.6 milestone Apr 30, 2014

@eoseubert

This comment has been minimized.

Copy link
Author

commented Apr 30, 2014

Ok thanks. Also, the ARResults doesn't have a forecast method like in the ARMAResults. Not sure if that is intentional or not.

@jseabold

This comment has been minimized.

Copy link
Member

commented Apr 30, 2014

Yeah, ARMA is always going to be more full featured I think. Could probably add a forecast method to AR but it may be non-trivial. I'd have to look.

@eoseubert eoseubert closed this May 1, 2014

@eoseubert eoseubert reopened this May 1, 2014

@jseabold jseabold closed this Sep 20, 2014

@GuillaumeLeclerc

This comment has been minimized.

Copy link

commented Apr 16, 2017

Hello,

I think it is still not implemented. It has been closed though. Any explanation ? Or Am I doing something wrong (I have an instance of ARResultsWrapper and according to the docs it's on ARResults. I looked at the code and I'm not sure how to "UnWrap" it.

Thank you for your help

@josef-pkt

This comment has been minimized.

Copy link
Member

commented Apr 16, 2017

@GuillaumeLeclerc The preferred model is now SARIMAX which has get_prediction with more features.
Most likely enhancing AR will not be a priority anymore and might eventually be deprecated, unless someone comes up with a good reason to keep it.

@GuillaumeLeclerc

This comment has been minimized.

Copy link

commented Apr 16, 2017

Ok thank you. It might be good to have the documentation up to date to avoid confusion I think. If the argument is not supported it should not be there.

@GuillaumeLeclerc

This comment has been minimized.

Copy link

commented Apr 17, 2017

@josef-pkt Sorry to come back to you. I tried what you suggested and I just can't fit my model with SARIMAX (I also tried with ARMA and ARIMA), even though it is perfectly fine with AR (and I get pretty good predictions on my testing data)

Here what I have

fit_AR = AR(training_data).fit(MAX_LAG_MODELING).params.values
print(fit_AR)
fit_SARIMAX = SARIMAX(training_data, order = (1, 0, MAX_LAG_MODELING)).fit(disp = False)
print(fit_SARIMAX)

The second line prints the weights correctly (and they make sense when you compare them with the data).
On the other hand the fourth line fails. From my understanding of these models. The two should be perfectly equivalent but maybe I'm wrong.

For the third line I get

raise ValueError('non-invertible starting MA parameters found'
ValueError: non-invertible starting MA parameters found with `enforce_invertibility` set to True.

I don't see how with only one AM parameter I should get a non invertible filter (maybe if the weights becomes zero but then there might be an issue in the solver (I tried others solvers without any luck).

I tried tweeking the params and sometimes I get a different error. It says that the data is not stationary. Which is false according to the adf test.

I can't lower my MAX_LAG_MODELING because this is the seasonality of my data.

I hope there is a way to get these confidence intervals. Thank you very much for your help

@josef-pkt

This comment has been minimized.

Copy link
Member

commented Apr 17, 2017

You specified a MA model not an AR, ARMA(ar_order, differencing, ma_order)
an AR as ARMA would be order = (MAX_LAG_MODELING, 0, 0)

Given that you have seasonal data, you could try the seasonal ARMA specification, which would require fewer parameters than a full length AR. See docstring and example notebooks for SARIMAX

@GuillaumeLeclerc

This comment has been minimized.

Copy link

commented Apr 18, 2017

I'm sorry, but it's still not working. It is taking 100% of my CPU and never find a solution. With the AR model it takes less than a second. I don't understand this difference since I only have AR parameters. Is it normal ?

EDIT: It never finished actually (SIGKILL from the OS because it was taking too much ram)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.