[R-SIG-Finance] copula with rmgarch
alexios ghalanos
alexios at 4dscape.com
Wed May 9 18:31:26 CEST 2012
1. GHST was added recently to rugarch and I have not updated the rmgarch
package to accomodate this (I guess it is due for an update soon).
2. If you only want mean-covariance, you can recover the conditional
mean forecast directly by using the 'varxforecast' function (if using
VAR) else from the univariate model using the 'fitted' method on the
'uGARCHfit' object (READ THE DOCUMENTATION).
If you want a 1-ahead "scenario", use the "m.sim" option.
3. Only THE Gaussian and Student copula are implemented.
4. 'residuals(fit)' is NOT standardized. You have to do that yourself by
extracting the covariance and performing the appropriate
decomposition/transformation in the multivariate case.
However, if you want to fit your own copula in a 2nd stage after GARCH,
very briefly:
- Filter data with univariate GARCH (see also 'multifit').
- Extract and standardize residuals: 'residuals(fit)/sigma(fit)'.
- Transform into uniform (parametric approach) by 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 (read the documentation). For
non-parametric or semi-parametric transformation you should look at the
code in the cgarchfit function.
-Alexios
On 09/05/2012 16:47, Alex Fei wrote:
> Thank you Alexios for always prompt and patient reply!
>
> Yes, you are right. It does not make sense to look at the simulated cov for
> 1-ahead. I was trying to do a portfolio allocation exercise.
>
> 1) If the mean-variance approach is adopted, basically what I need is the
> 1-day-ahead return of each assets and their cov. I suppose the former should
> come from the margin parts (e.g. ARMA(1,1)-GARCH(1,1)-ghst) given the
> estimated marginal parameters and the latter should come from the copula
> part (e.g. DCC(1,1)-t-copula) given the estimated copula parameters. In R,
> *what shall I do?* for example I have the following:
>> library(rmgarch)
>> data(dji30ret)
>> Dat = dji30ret[, 1:3, drop = FALSE]
>> uspec = ugarchspec(mean.model = list(armaOrder = c(1,1)), variance.model =
>> list(garchOrder = c(1,1), model = "sGARCH"),
> + distribution.model = "jsu")
>> spec1 = cgarchspec(uspec = multispec( replicate(3, uspec) ), VAR = FALSE,
>> robust = FALSE, lag = 2, lag.max = NULL,
> + lag.criterion = c("AIC", "HQ", "SC", "FPE"),
> external.regressors = NULL,
> + robust.control = list("gamma" = 0.25, "delta" = 0.01,
> "nc" = 10, "ns" = 500),
> + dccOrder = c(1,1), asymmetric = FALSE,
> distribution.model = list(copula = c("mvnorm", "mvt")[2],
> +
> method = c("Kendall", "ML")[2], time.varying = TRUE,
> +
> transformation = c("parametric", "empirical", "spd")[1]))
>> fit1 = cgarchfit(spec1, data = Dat, parallel = parallel, parallel.control
>> = parallel.control,
> + fit.control = list(eval.se=TRUE))
>> show(fit1)
>
> *-------------------------------------------------*
> * Copula GARCH Fit *
> *-------------------------------------------------*
>
> Distribution : mvt
> DCC Order : 1 1
> Asymmetric : FALSE
> No. of Parameters : 30
> [VAR GARCH DCC UncQ]: [0+24+3+3]
> No. of Series : 3
> No. of Observations : 5521
> Log-Likelihood : 43676.18
> Av.Log-Likelihood : 7.911
>
> Optimal Parameters
> ---------------------------------------------------
> Estimate Std. Error t value Pr(>|t|)
> [AA].mu 0.000531 0.000252 2.106962 0.035121
> [AA].ar1 -0.582146 0.075357 -7.725139 0.000000
> [AA].ma1 0.638169 0.069877 9.132792 0.000000
> [AA].omega 0.000003 0.000001 2.046048 0.040752
> [AA].alpha1 0.045806 0.008897 5.148264 0.000000
> [AA].beta1 0.948470 0.012120 78.255127 0.000000
> [AA].skew 0.141182 0.069022 2.045450 0.040810
> [AA].shape 1.902134 0.111488 17.061336 0.000000
> [AXP].mu 0.000627 0.000168 3.732932 0.000189
> [AXP].ar1 0.730182 0.072262 10.104678 0.000000
> [AXP].ma1 -0.784923 0.065556 -11.973334 0.000000
> [AXP].omega 0.000001 0.000001 1.893198 0.058332
> [AXP].alpha1 0.058253 0.012840 4.536872 0.000006
> [AXP].beta1 0.940747 0.014063 66.893758 0.000000
> [AXP].skew 0.131492 0.048365 2.718777 0.006552
> [AXP].shape 1.868931 0.097636 19.141771 0.000000
> [BA].mu 0.000586 0.001033 0.567440 0.570415
> [BA].ar1 -0.385522 5.202037 -0.074110 0.940923
> [BA].ma1 0.394759 5.336133 0.073978 0.941028
> [BA].omega 0.000004 0.000005 0.729471 0.465714
> [BA].alpha1 0.046706 0.056782 0.822551 0.410764
> [BA].beta1 0.942283 0.066474 14.175183 0.000000
> [BA].skew 0.072497 0.522772 0.138678 0.889705
> [BA].shape 1.710008 0.085270 20.054081 0.000000
> [Joint]dcca1 0.008234 0.001330 6.190368 0.000000
> [Joint]dccb1 0.989416 0.002026 488.351900 0.000000
> [Joint]mshape 13.574529 1.569377 8.649627 0.000000
>
> Information Criteria
> ---------------------
>
> Akaike -15.812
> Bayes -15.780
> Shibata -15.812
> Hannan-Quinn -15.801
>
>
> Elapsed time : 1.85734
>
> ps. seems I can't use ghst for GH skew-t but use jsu instead. When I use
> ghst in ugarchspec, the cgarchfit will report the following error message:
> Error in if (!any(distribution == valid.distribution))
> stop("\nugarchspec-->error: the cond.distribution does not appear to be a
> valid choice.") :
> missing value where TRUE/FALSE needed
>
> 2) If the mean-CVaR approach is adopted, I suppose to have a large number
> (say, 10000) of 1-day-ahead return of each assets at different scenarios. I
> think it can be done with sim1 = cgarchsim(fit1, n.sim = 1, m.sim = 10000,
> startMethod = "sample"). *Am I right?*
>
> 3) for other exercises, i.e. fitting Archimedean copulas (seems like the
> rmgarch package only support gaussian and t copula), I need transform the
> standardised residuals to uniform via CDF or ecdf. I suppose the residuals
> is standardised (*Am I right?*) by using rugarch, again assume
> ARMA(1,1)-GARCG(1,1)-ghst, then *how can I do this transformation* to obtain
> uniform pseudo-observations to start a fitting using copula package? Btw, do
> you have any suggestion to do this exercise?
>
> --
> View this message in context: http://r.789695.n4.nabble.com/copula-with-rmgarch-tp4616138p4620878.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