stepwise AIC/BIC on ARIMA (or even ARMA) in R?

Discussion in 'Automated Trading' started by lolatency, Apr 27, 2009.

  1. Is there a way to do this in R? I tried looping through a set of p and q values, but the arima() function chokes in certain combinations. Is there a smart method that will do this correctly?

    Or, alternatively, is there a way where I can catch exceptions and let the search process continue?
  2. Jump1180


    I do something very similar to what you are trying to do only I use SAS. ARIMA and ARMA models can fail to estimate depending on the time series and desired (p,d,q)(P,D,Q) values that are specified. I was able to correct this by increasing the number of interations the ARIMA model would process in order to estimate the parameters used to forecast. SAS's Time Series Forecast System GUI would fail to estimate for me on when forecasting stock data so I used Proc ARIMA as a work around with a high number of iterations as a work around. In proc arima there was a maxiter=x option that I increased to between 10,000 and 30,000 iterations. This did the trick for me. I'm not sure if there is a similar option in R but it might be worth a try.
  3. Yeah, I am looking for something like the step(), but for time series. For now, I've settled with eyeballing the PACF and ACF, then tinkering with the parameters until I manually kill off the AIC.

    The arima() function in R seems seriously broken. I get better results by manually differencing and dropping down to arma(). It seems there are several tutorials on the web suggesting the arima() mode of operation isn't quite correct.
  4. > ?try

    try(base) R Documentation

    Try an Expression Allowing Error Recovery

    try is a wrapper to run an expression that might fail and allow the user's code to handle error-recovery. ...
  5. There's a book by some guy called Rupert (Introduction to Statistical Methods in Finance or something), and he wrote it for some master's level class at Cornell -- in his book, I think he used SAS, and SAS somehow generated a beautiful table where it showed the results of all of the models in this nice tabular format.

    I can't afford SAS, but I was hoping there was some clean procedure to generate this for your usual ARIMA models.
  6. attach a time series that you want to find ARIMA AIC for. If I have time, I'll look.
    Also, indicate max p and q desired.

  7. When I made the post, I was still in graduate school. ;-) No need for it now in particular, though I think that chart you have there is f'in beautiful! I need to read that code.