library(quantmod) source("garchAuto.R") spy = getSymbols("SPY", auto.assign=FALSE) rets = ROC(Cl(spy), na.pad=FALSE) fit = garchAuto(rets, cores=8, trace=TRUE)
After the last code line above, fit contains the best (according to the AIC statistic) model, which is the return value of garchFit. The function has reasonable defaults, but also provides controls over various aspects of the model selection – check the code.
The function is called garchAuto, following the naming convention of the fGarch package. In fact, I am trying to get it into the fGarch package, but haven’t heard back yet. There are reasons why I don’t feel too optimistic about this happening, hence, my decision to publish it here.
Last, if you wonder why I abandoned the original garchSearch name, the reason is that a similar function from the forecast package is called auto.arima (“auto”, not “search”).