5
$\begingroup$

I was working on ARIMA in R and I am trying not to use library forecast as much as possible. I have a code for finding the best ARIMA model, but it is showing some warning messages.

Here is my function:

best.aic<-1e8
n<-length(x.ts)
for(p in 0:maxord[1]) for(d in 0:maxord[2]) for(q in 0:maxord[3])
{   
        fit<-arima(x.ts,order=c(p,d,q))
    fit.aic<--2*fit$loglik+(log(n)+1)*length(fit$coef)
    if(fit.aic<best.aic)
    {
        best.aic<-fit.aic
        best.fit<-fit
        best.model<-c(p,d,q)
    }
}
list(best.aic,best.fit,best.model)

It gives the same warning 4 times:

In arima(x.ts, order = c(p, d, q)) :
possible convergence problem: optim gave code=1

Also, I will appreciate any help concerning simulation of ARIMA by hand, not by arima.sim function. Thank you.

$\endgroup$
  • $\begingroup$ Please take in mind that I am new to both arima and R (started working in Jan this year), hence please make the answers simpler, however any help is appreciated. $\endgroup$ – Abhilash Vedwan Mar 23 '13 at 3:05
  • 1
    $\begingroup$ You appear to be asking two fairly unrelated questions (and your title doesn't relate to the first one at all). You should probably ask two different questions. Please take care that they both fall inside the bounds for CV questions given in the faq. $\endgroup$ – Glen_b Mar 23 '13 at 3:54
  • $\begingroup$ Sorry, I will try to be more careful. However is there something wrong in the above code. As for arima, is there any place where I can find its implementation, or can get enough understanding to implement it myself. $\endgroup$ – Abhilash Vedwan Mar 23 '13 at 5:33
6
$\begingroup$

The warning is because the normal optimization for the MLE has reached the default maximum number of iterations before convergence. You can increase that by adding optim.control = list(maxit = ?) at the end of your ARIMA fit. Something like arima(x.ts,order=c(p,d,q),list(maxit = 1000)). I think the default for ? is 500 but you can increase it.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.