Hello, I'm running a number of arima models using the "arima" function. Often, when lag length gets too high, these model don't converge and an error message appears as this: > reg <- arima(y,order=c(7,0,7),xreg=isr) Warning message: In arima(y, order = c(7, 0, 7), xreg = isr) : possible convergence problem: optim gave code=1
In this case, when you print the results from the arima model, the error message appears again: > reg Call: arima(x = y, order = c(7, 0, 7), xreg = isr) Coefficients: ar1 ar2 ar3 ar4 ar5 ar6 ar7 ma1 ma2 -0.3356 0.0282 -0.0124 0.0604 0.1608 0.7949 0.2286 0.4461 0.0099 s.e. NaN 0.2140 0.1711 0.2545 0.1547 0.0725 NaN NaN 0.1842 ma3 ma4 ma5 ma6 ma7 intercept isr 0.0841 0.0773 -0.054 -0.7227 -0.1322 6.1433 -0.0818 s.e. 0.1911 0.2689 NaN 0.1774 NaN 5.0604 0.2110 sigma^2 estimated as 4.542: log likelihood = -651.68, aic = 1337.36 Warning message: In sqrt(diag(x$var.coef)) : NaNs produced I'm writing a loop to run several of these models and I would like to include an if statement with instructions in case there is a possible convergence problem. Is there any way to automatically detect a warning like this without visually inspecting each result? I tried warnings(arima(y,order=c(7,0,7),isr), but I don't think that will get me what I want. The contents of an arima object are below. I was hoping one of them would include error messages, but I haven't been able to find it. > summary(reg) Length Class Mode coef 16 -none- numeric sigma2 1 -none- numeric var.coef 256 -none- numeric mask 16 -none- logical loglik 1 -none- numeric aic 1 -none- numeric arma 7 -none- numeric residuals 299 ts numeric call 4 -none- call series 1 -none- character code 1 -none- numeric n.cond 1 -none- numeric model 10 -none- list Thanks in advance for any help. -Mitch ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.