Rmgarch : Multivariate Copula-DCC-GARCH (VAR=FALSE) Model

rmgarch
copula

#1

By refer to dynamic copula using rmgarch package (ignore previous question, don't know how to delete it), I tried to modify to be aDCC , DCC or even the Fractional Intergrated univariate-GARCH and run the coding, and its works, when I tried to change the data, the error prompt me as showing below. Somebody shade me a light?

> dim(HiLo.base)
[1] 1476    2
> library(rugarch) 
> library(rmgarch) 
> library(forecast)
> library(plyr)
> library(dplyr)
> 
> Dat = HiLo.base[,, drop = FALSE] 
> armaorder <- llply(Dat, function(x) {
+   arimaorder(auto.arima(x))})
> 
> model <- llply(armaorder, function(x) {
+   ugarchspec(variance.model=list(model="gjrGARCH", garchOrder=c(1,1), variance.targeting=FALSE), 
+              mean.model=list(armaOrder=c(x[1],x[3]), include.mean=F, archm=F, 
+                              archpow=1, arfima = TRUE), 
+              fixed.pars = list(arfima = x[2]), distribution.model="norm")
+   })
> spec = cgarchspec(uspec = multispec(model), VAR = FALSE, robust = FALSE, 
+                   lag.criterion = "AIC", external.regressors = NULL, 
+                   dccOrder = c(1,1), asymmetric = TRUE, 
+                   distribution.model = list(copula = "mvt", method = "ML", 
+                                             time.varying = TRUE, 
+                                             transformation = "spd")) 
> fit = cgarchfit(spec, data = Dat, out.sample = 570, cluster = NULL, 
+                 spd.control = list(lower = 0.1, upper = 0.9, type = "mle", kernel = "normal"), 
+                 fit.control = list(eval.se=FALSE)) 
> T = dim(Dat)[1]-570 
> simMu = simS = filtMu = filtS = matrix(NA, ncol = 2, nrow = 570) 
> simCor = simC = filtC = filtCor = array(NA, dim = c(2,2,570)) 
> colSd = function(x) apply(x, 2, "sd") 
> specx = spec 
> for(i in 1:2) specx@umodel$fixed.pars[[i]] = as.list(fit@model$mpars[fit@model$midx[,i]==1,i]) 
> setfixed(specx)<-as.list(fit@model$mpars[fit@model$midx[,3]==1,3]) 
> 
> simulatedreturns <- array(dim=c(570,2,5000)) 
> for(i in 1:570){ 
+   if(i==1){ 
+     presigma = matrix(tail(sigma(fit), 1), ncol = 2) 
+     prereturns = matrix(unlist(Dat[T, ]), ncol = 2, nrow = 1) 
+     preresiduals = matrix(tail(residuals(fit),1), ncol = 2, nrow = 1) 
+     preR = rcor(fit)[,,1] 
+     diag(preR) = 1 
+     preQ = fit@mfit$Qt[[length(fit@mfit$Qt)]] 
+     preZ = tail(fit@mfit$Z, 1) 
+     tmp = cgarchfilter(specx, Dat[2:(T+1), ], filter.control = list(n.old = T)) 
+     filtMu[i,] = tail(fitted(tmp), 1) 
+     filtS[i,] = tail(sigma(tmp), 1) 
+     filtC[,,i] = rcov(tmp)[,,1] 
+     filtCor[,,i] = rcor(tmp)[,,1] 
+   } else{ 
+     presigma = matrix(tail(sigma(tmp), 1), ncol = 2) 
+     prereturns = matrix(unlist(Dat[(T+i-1), ]), ncol = 2, nrow = 1) 
+     preresiduals = matrix(tail(residuals(tmp),1), ncol = 2, nrow = 1) 
+     preR = rcor(tmp)[,,1] 
+     diag(preR) = 1 
+     preQ = tmp@mfilter$Qt[[length(tmp@mfilter$Qt)]] 
+     preZ = tail(tmp@mfilter$Z, 1) 
+     
+     tmp = cgarchfilter(specx, Dat[(i+1):(T+i), ], filter.control = list(n.old = T)) 
+     filtMu[i,] = tail(fitted(tmp), 1) 
+     filtS[i,] = tail(sigma(tmp), 1) 
+     filtC[,,i] = rcov(tmp)[,,1] 
+     filtCor[,,i] = rcor(tmp)[,,1] 
+   }
+   sim = cgarchsim(fit, n.sim = 1, m.sim = 5000, startMethod = "sample", 
+                   preR = preR, preQ = preQ, preZ = preZ, 
+                   prereturns = prereturns, presigma = presigma, 
+                   preresiduals = preresiduals, cluster = NULL) 
+   simx = t(sapply(sim@msim$simX, FUN = function(x) x[1,])) 
+   simMu[i,] = colMeans(simx) 
+   simC[,,i] = sim@msim$simH[[1]][,,1] 
+   simCor[,,i] = sim@msim$simR[[1]][,,1] 
+   simS[i,] = sqrt(diag(simC[,,i])) 
+   simulatedreturns[i,,]=simx 
+ } 
Error in .custzdist(custom.dist, zmatrix, m.sim, n) : row dimension
                of custom innovations
 matrix must be equal to n.sim+n.start
In addition: Warning messages:
1: In .gpdpwmFit(x, u) :
  Asymptotic Standard Errors not available for PWM when xi>0.5.
2: In .gjrgarchpath2(spec = spec, n.sim = n.sim, n.start = n.start,  : 
ugarchpath-->warning: n.start>=MA order for arfima model...automatically setting.

Releted to my another post Copula-DCC-GARCH : rmgarch::cgarchsim() and rmgarch::varxforecast() but this post is deepth in VAR=FALSE (Vector Autoregresive) model.