Hi, I'm new here, so please excuse me for violation of local rules, if this happens.
First, I've seen this problem here, it is more or less the same: http://r.789695.n4.nabble.com/RUGARCH-bootstrap-fitting-error-presigma-length-td4634470.html <http://r.789695.n4.nabble.com/RUGARCH-bootstrap-fitting-error-presigma-length-td4634470.html> However, I have the newest version (I suppose so) 1.4-1 of rugarch package, and the error is still in place. I think, there is a problem with my code then. So, any help would be appreciated greatly. I'm trying to forecast some financial returns with so-called copula-garch method. When I run the code woth ARMA(1,1) - it's ok, but with ARMA(2+, q) it returns: "Error in .sgarchpath2(spec = spec, n.sim = n.sim, n.start = n.start, m.sim = m.sim, : ugarchpath-->error: presigma must be of length 2" Here is the simulation part of the code (originally taken from here with minor changes of distribution model and a bit more: http://www.unstarched.net/r-examples/rugarch/simulated-rolling-forecast-density/ <http://www.unstarched.net/r-examples/rugarch/simulated-rolling-forecast-density/>) specm <- ugarchspec(variance.model=list(model="sGARCH", garchOrder=c(1,1), submodel = NULL), mean.model=list(armaOrder=c(2,1), include.mean=TRUE), distribution.model = 'std') fsim <- matrix(NA, ncol = 60, nrow = 5000) # we will also create the closed form forecast afor <- matrix(NA, ncol = 60, nrow = 2) rownames(afor) <- c('Mu', 'Sigma') colnames(afor) = colnames(fsim) = rep(paste('T+', 1:10, sep = ''), 6) # T+1 we can use ugarchsim: for (i in 0:5) { fit <- ugarchfit(specm, returns[1:405, i+1]) specf <- ugarchspec(variance.model=list(model="sGARCH", garchOrder=c(1,1), submodel = NULL), mean.model=list(armaOrder=c(2,1), include.mean=TRUE), distribution.model = 'std', fixed.pars = as.list(coef(fit))) tmp <- ugarchsim(fit, n.start = 0, startMethod = 'sample', n.sim = 1, m.sim = 5000, custom.dist = list(name = 'sample', distfit = t(new_res[,i+1]))) fsim[, (1+10*i)] = as.numeric(fitted(tmp)) tmp <- ugarchforecast(fit, n.ahead = 1) afor[, 1+10*i] <- c(fitted(tmp), sigma(tmp)) } ### # for T+(i>1): for (j in 0:5) { fit <- ugarchfit(specm, returns[1:405, j+1]) specf <- ugarchspec(variance.model=list(model="sGARCH", garchOrder=c(1,1), submodel = NULL), mean.model=list(armaOrder=c(2,1), include.mean=TRUE), distribution.model = 'std', fixed.pars = as.list(coef(fit))) for (i in 2:10) { filt <- ugarchfilter(specf, data = returns[1:(405 + i - 1), j+1], n.old = 405) path <- ugarchpath(specf, n.sim = 1, m.sim = 5000, presigma = tail(sigma(filt), 1), prereturns = returns[(405 + i - 1), j+1], preresiduals = tail(residuals(filt), 1), custom.dist = list(name = 'sample', distfit = t(new_res[,j+1]))) fsim[, i+10*j] <- as.numeric(fitted(path)) tmp <- ugarchforecast(specf, returns[1:(405 + i - 1), j+1], n.ahead = 1) afor[, i+10*j] <- c(fitted(tmp), sigma(tmp)) } } Hope, my point is clear! Thank you in advance! [[alternative HTML version deleted]] _______________________________________________ [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.
