[R-SIG-Finance] Question rmgarch package

alexios ghalanos alexios at 4dscape.com
Fri Jun 26 10:00:00 CEST 2015


There could be any number of reasons this is happening, but I just can't
tell from the information you've provided. I suggest you try to
eliminate some possibilities as a first pass:

1. Use: startMethod = "sample" (in gogarchsim)
2. You're providing your own ICA decomposition matrices in the spec.
Try using the default estimation first (and set n.comp=4) without
providing your own matrices.
3. Try without dimensionality reduction.
4. The convolution method has additional fine tuning parameters. You may
need to adjust those (fft.step, fft.by etc).
5. For comparison, try a Cornish-Fisher expansion as explained here:
http://unstarched.net/r-examples/rmgarch/var-and-approximate-var-in-the-go-garch-nig-model/

Regards,

Alexios

On 25/06/2015 21:27, daniel melendez via R-SIG-Finance wrote:
> Hello All -  I am trying to complete a simulation based off of given information from a gogarchfit object but I seem to be obtaining really low VaR numbers.  Can anyone help explain this?  Also I saw on a previous post from the r-sig-finance mailing list that the standardized residuals can be obtain by taking the square root of the covariance matrix, however, I seem to be getting rather large numbers.  Can anyone help explain this too?  Any help would greatly appreciated.   The code snippets are below: # specs for GO-GARCH model
> #----------------------------------------------------------------------------
> spec = gogarchspec(mean.model = list(model = 'constant'),
>   variance.model = list(model = 'eGARCH', 
>   garchOrder = c(1, 1), variance.targeting = TRUE), 
>   distribution = 'manig', ica = 'fastica', 
>          ica.fix = list(A = est_mixing_matrix, K = whitening_matrix,
>                         W = est_unmixing_matrix, U = est_rotation_matrix,
>                         Kinv = dewhitening_matrix, Y = est_indep_components_matrix)) # GO-GARCH Fit
> #----------------------------------------------------------------------------
> cl <- makePSOCKcluster(3)
> mod2 = gogarchfit(spec = spec, data = garchSeries, gfun = 'tanh', cluster = cl, 
>                   solver = "hybrid", firstEig = 1, lastEig = 4, 
>                   solver.control = list(trace = 1), 
>                   maxiter1 = 40000, epsilon = 1e-08, rseed = 972,
>    fit.control = list(stationarity = 1)) 
>                                                         
> stopCluster(cl)  # Simulation Generation
> # --------------------------------------------------------------------------------
> cl <- makePSOCKcluster(3)
> sim1 <- gogarchsim(mod2, n.sim = 50, n.start = 0, 
>    m.sim = 5000, 
>    rseed = 214, cluster = cl)
> stopCluster(cl) cf = convolution(sim1, weights = matrix(rep(1/10, 10), ncol = 10, nrow = 50)) 
> VaR = matrix(NA, ncol = 2, nrow = 50)
> colnames(VaR) = c('qfft[0.9999]', 'qfft[0.0001]')
> for (i in 1:50){
>     qfx = qfft(cf, index = i)
>     VaR[i, 1] = qfx(0.9999)
>     VaR[i, 2] = qfx(0.0001)
> }
> matplot(VaR, type = 'l')  #----------------------------------------------------------------------# Calculate the standardized residuals for the model
> # ---------------------------------------------------------------------
> residualsModel <- residuals(mod2)
> cov.sq <- rcov(mod2)
> sq.cov <- array(NA, dim = c(dim(cov.sq)[1],
>                             dim(cov.sq)[2],
>                             dim(cov.sq)[3]))
> sq.cov.mat <- function (x){
>     tmp = svd(x)
>     sqrtx = tmp$u %*% sqrt(diag(tmp$d)) %*% t(tmp$u)
>     return(sqrtx)
> }
> for(i in 1:dim(cov.sq)[3]){
>     sq.cov[,,i] <- solve(sq.cov.mat(cov.sq[,,i]))
> }
> stand.resid <- matrix(NA, ncol = ncol(residualsModel), nrow = nrow(residualsModel))
> for(i in 1:dim(sq.cov)[3]){
>     stand.resid[i,] <- t(sq.cov[,,i] %*% as.numeric(residualsModel[i,]))  
> }     Regards 
> Daniel Melendez
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-SIG-Finance at r-project.org 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.
>



More information about the R-SIG-Finance mailing list