# How to check whether maximum likelihood estimation optimizer has converged in R?

I got AIC values of all models to identify the best model using R language. As I heard, best model produce the smallest AIC value, but maximum likelihood estimation procedure optimizer should converge.

How can I check whether maximum likelihood estimation procedure optimizer has converged or not in R language?

• What R function are you talking about ? – Stéphane Laurent Jul 3 '12 at 5:13
• I have already fitted several models using R code; arima(rates,c(p,d,q)) – Anthony Jul 3 '12 at 7:57

If you're using the arima function as
mod <- arima(rates,c(p,d,q))

then the convergence status from the underlying optim routine is
mod$code  If this is 0 then you converged, at least as far as optim was concerned. See ?optim for details. This is all in the help page: ?arima Assuming you have a globally convex likelihood and a regular parameter space, then the optimizer may have not converged when it reaches a boundary of the parameter space. This yeilds parameter estimates which explode and information matrices which are singular. Usually any graphical method is good at diagnosing that. Some estimation problems have unique solutions which are on the boundary of the parameter space, though, such as separation of outcomes in univariate logistic regression, giving odds ratios which are$\infty\$ or 0.