[R-SIG-Finance] I want to find the best arima model using AIC criterion, but having problems
BSanders
adam at mycostech.com
Mon Jan 17 05:42:14 CET 2011
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)
--
View this message in context: http://r.789695.n4.nabble.com/I-want-to-find-the-best-arima-model-using-AIC-criterion-but-having-problems-tp3220695p3220695.html
Sent from the Rmetrics mailing list archive at Nabble.com.
More information about the R-SIG-Finance
mailing list