0

In package rugarch,

I want to list out the AIC of several garch models in R. But I don't know how to to :(, So I use the loop for to get the infocriteria of them. my code below:

for(i in 1:5)
  {
  for(j in 1:5)
    {
    garch11.spec=ugarchspec(variance.model=list(garchOrder=c(i,j)))
    garch11.fit=ugarchfit(spec=garch11.spec, data=google_rets)
    print(infocriteria(garch11.fit))
    }
  }

After running 2 models, an error occupts:

Error in itestm[1, 1] <- itest$AIC : replacement has length zero
In addition: Warning messages:
1: In .sgarchfit(spec = spec, data = data, out.sample = out.sample,  : 
ugarchfit-->warning: solver failer to converge.
2: In log(log(nObs)) : NaNs produced

How can I solve the error?

Could you give me a way to get the AIC from package rugrach

  • 1
    Please share your data using `dput` so others can help. See more here [How to make a great R reproducible example?](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – Tung May 31 '18 at 12:50

1 Answers1

0

You may use auto.arima() and arimaorder() to get the p,d,q values and fit into the ugarchspec(), it will be more effcient than using for loop...

You can use google translate and refer to binary.com 面试试题 I - GARCH模型中的ARIMA(p,d,q)参数最优化 for more information.