[R-SIG-Finance] rugarch and copulas

alexios ghalanos alexios at 4dscape.com
Fri Nov 9 12:12:33 CET 2012


Hi,

1. ok, you fit a GARCH model to each series (filter in rugarch means
you supply a pre-defined set of parameters without fitting).

2. Since version 1.0-12., you can use residuals(fit, standardize = 
TRUE). R-forge has 1.0-13 which is more up to date.

3. You have 3 choices for the transformation:
a. Empirical (ranks) -> Genest 1985 (Pseudo-Likelihood),
b. Semi-Parametric -> Davison and Smith (1990) (e.g. spd package),
c. Parametric -> Joe (1987) (Inference-Functions-for-Margins).
The rmgarch vignette contains details on the methods and relevant 
references.

 >args(pdist)
function(distribution = "norm", q, mu = 0, sigma = 1, lambda = -0.5,
     skew = 1, shape = 5)

Since you are passing (0,1) residuals, mu=0 and sigma = 1, but depending 
on what conditional distribution you used to fit the univariate GARCH 
models you will need to provide the additional parameters
e.g. from the "coef(fit)" you will have a shape and skew parameter if 
you fitted a distribution which has these parameters.

You will likely also find the code below useful once you have 
transformed your residuals into uniform variates:

# make tail adjustments in order to avoid problem with the quantile
# functions in optimization
if(any(UniformResiduals > 0.99999)){
ix = which(UniformResiduals > 0.99999)
UniformResiduals [ix] = 0.99999
}
if(any(UniformResiduals < .Machine$double.eps)){
ix = which(UniformResiduals < (1.5*.Machine$double.eps))
UniformResiduals [ix] = .Machine$double.eps
}


4./5 Correct

6. Incorrect. You first need to do a "reverse-transform" of the copula 
simulated values by using the qdist (quantile) function. THEN you plug 
in to the custom.dist function. These are now dependent (in the cross 
section) standardized residuals.

Note that this topic was also covered here:
http://r.789695.n4.nabble.com/Copula-in-R-td928826.html

As to the correctness of this approach, I would say it is a valid 
method, which adopts a 2/3 stage compromise rather than a full 1-stage 
ML approach which would be computationally forbidding. In the rmgarch
package, things are done slightly differently since the focus is on
using DCC based modelling with elliptical copulas (although the non-DCC
approach is also allowed).

Hope that clarifies.

-Alexios

On 09/11/2012 10:29, ludovic.theate wrote:
> Hi Alexios,
>
> Things are often clearer in the morning, and I think I changed a little bit
> my mind about what I said yesterday. I really do not like the fgarch
> package, since there is no well defined link between the fit and the
> simulation methods. I clearly prefer the architecture spec -> fit -> sim you
> use in rugarch.
>
> So I decided to give another try, and I just would like to ask to you (and
> of course the other people following this list) if you could approve/amend
> the following approach :
>
> 1)	I filter the data using an univariate rugarch model for each currency I
> am modelling.
> 2)	I evaluate the standardized residuals using “residuals(fit)/sigma(fit)”
> as explained in a previous threat.
> 3)	I transform them into uniform using either the ranks, or using a
> parametric approach you described in the thread I was talking about.
> Unfortunately, I am not sure I understand your explanation (“extracting any
> conditional higher moment parameters from the GARCH fitted object and pass
> those with the standardized residuals to the "pdist" function of rugarch
> indicating the distribution used”). Could you explain with a little more
> details please ?
> 4)	With this matrix of uniform marginals, I am able to fit the copulas I am
> interested in (even nested, or vine ones), compare them, make tests, and
> choose the most appropriate one.
> 5)	Using this copula, I can generate a random n_currencies x n_simulations x
> n_horizon matrix containing the innovations.
> 6)	Then, if I’ve correctly understood, I can simply plug each row (for each
> currency) of this matrix inside the “ custom.dist = list(name = NA, distfit
> = NA) “ option of ugarchsim and simulate the trajectories. Is it correct ?
> If I made this for each currencies, I will get correlated sample
> trajectories.
>
> Do you think this kind of algorithm is correct ? Once again, thanks for your
> help.
>
> Regards,
>
> Ludovic
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/rugarch-and-copulas-tp4647300p4649023.html
> Sent from the Rmetrics mailing list archive at Nabble.com.
>
> _______________________________________________
> 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