[R-SIG-Finance] GARCH convergence error in for-loop
Hannah Linder
hlinder33 at gmail.com
Wed Oct 21 21:19:15 CEST 2015
Hello,
I am using the rugarch package to fit to simulated data. I am fitting the
same garch model to 1000 simulated data sets (all very similar with
slightly different error). Within each data set I am using 10-fold CV, so I
am fitting the model to 10 training sets. When I run the code (shown below)
I occasionally receive the error:
Solver Message: Error in is.nloptr(ret) : at least one element in x0 < lb
When I re-run the exact same code starting from the iteration that caused
and error, the error goes away. Does anyone know if this may be an error
with R or if I am missing a problem in the model?
Thank-you very much for your time!
Code:
library(rugarch)
fit.spec1=array(list(),c(1000,10))
fit1=array(list(),c(1000,10))
for (j in 1:1000){
for (i in 1:10){
fit.spec1[[j,i]]=ugarchspec(variance.model = list(model = "sGARCH",
garchOrder = c(1,
1),external.regressors=as.matrix(train.all[[j]][[i]][,c(5,6)])),
mean.model= list(armaOrder = c(1,1),
include.mean = T,
external.regressors=as.matrix(train.all[[j]][[i]][,c(2,4,5,6)])),
distribution.model = "sstd")
fit1[[j,i]] <- ugarchfit(data=train.all[[j]][[i]][,c(1)],spec =
fit.spec1[[j,i]],solver="hybrid")
}}
I am actually using the model on biological data, rather than finance. The
regressors in the model are Julian day count (2), tidal range (4), and a
sin and cos (5,6) transform for time-of-day (24-hr period).
[[alternative HTML version deleted]]
More information about the R-SIG-Finance
mailing list