HI think too for this purpose auto.arima model might be good.
Concerning your loop, the problem is not in your loop I believe, but simply that numerical procedure in arima() does not converge (i have seen this problem quite often). You might try using rather method=CSS (the usual least square).
Le 17. 01. 11 13:26, Paul Teetor a écrit :
Have you considered using the auto.arima function in the 'forecast' package? It searches for the best ARIMA model using the AIC, AICc, or BIC criteria. It might save you a lot of aggravation. Paul Teetor, Elgin, IL USA http://quanttrader.info/public ________________________________ From: BSanders<[email protected]> To: [email protected] Sent: Sun, January 16, 2011 10:42:14 PM Subject: [R-SIG-Finance] I want to find the best arima model using AIC criterion, but having problems I'm running a loop for trying to find the best ARIMA seasonal model. I'm experimenting with different orders of AR, MA and differencing.., but when I run my loops, I'm getting an error such as "Error in optim(init[mask], armafn, method = optim.method, hessian = TRUE, : non-finite finite-difference value [3] " and R exits the loop, however, it isn't finished. Is there a way to make R continuing what it should? My code looks like this below : count = 0 for(i in 0:7){ for(j in 0:2) { for(k in 0:1) { for(l in 0:1) { for(m in 0:2) { for(n in 0:1) { for(o in 1:2) { model = arima(y, order=c(i,j,k), seasonal=list(order=c(l,m,n), period=7*o)) if (count == 0){ aicmin = model$aic bestmodel = model } if ((count != 0)&& (model$aic< aicmin)){ aicmin = model$aic bestmodel = model diff1 = j diff2 = m seas = o*7 } count = count+1 } } } } } } } print(bestmodel) print(count) print(diff1) print(diff2) print(seas)
_______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
