[R-SIG-Finance] GARCH fitted parametric distributions for copula fitting
alexios ghalanos
alexios at 4dscape.com
Mon May 12 22:43:11 CEST 2014
Sebastian,
1. It is not the @fit$fitted.values you should use (which BTW you should
extract using the 'fitted' method), but the standardized residuals.
>z = residuals(fit, standardize=TRUE)
2. Once you have these, you should then convert them to U(0,1) by
applying the parametric transformation (IFM). Since you've used the
student distribution:
>pdist("std", z, 0, 1, shape = coef(fit)["shape"])
Alternatively, use the probability integral transformation method (pit):
>pit(fit)
which will return the U(0,1) in one step.
It is the U(0,1) values that you pass to the copula.
The copula-GARCH with student and normal margins are already available
in the rmgarch package whose functions (source) or documentation you may
want to consult to see the steps.
Regards,
Alexios
On 12/05/2014 21:21, Sebastian Ivanciu wrote:
> Hello,
>
> I would greatly appreciate any insights into the problem described below,
> regarding using the data obtained from applying the functions of the
> 'rugarch' package into those from the 'copula' package.
>
> I am endeavouring an investigation of dependencies between variables (i.e.
> stock quotes, exchange rates etc.) using copula functions. I first model
> each of my variables as an ARMA-GARCH process (or EGARCH/GJR to account for
> asymmetries) and then use these models in order to determine the
> best-fitting copula.
>
> Take for example the case of stock quotes. After transforming them to log
> returns ( using diff(log(stockData)) ), and investigating their correlation
> with Kendall's thau and Spearman's rho, I fit an ARMA-GARCH model to each
> variable (resulting in the so-called margin functions):
>
> ## Choose conditional mean model for each variable i in the retStock xts
> object
> autoarfima(data = retStock[,i], ar.max = 3, ma.max = 3, criterion = "AIC",
> method = "full", distr = "std")
>
> ## Choose conditional variance model by comparing AICs for all combinations
> of GARCH orders limited to 3, with the ARMA(p,q) mean model selected above
> for (i in 1:3){
> for (j in 1:3){
>
> spec <- ugarchspec(variance.model=list(model="sGARCH", garchOrder =
> c(i,j)), mean.model=list(armaOrder=c(p,q), distribution.model = "std")
>
> fit <- ugarchfit(spec = spec, data = retStock[,n])
>
> # record AIC for overall comparison after exiting the loop
> }
>
> }
>
> Keeping the uGARCHfit object with the best-fitting model, I move on to the
> bivariate copulas. For completing the "Inference Functions for Margins"
> method, I specifically need to input the observations from the *fitted
> parametric marginal distribution functions*, for which I use the
> *@fit$fitted.values* of each uGARCHfit object.
>
> However, the fitted values of the two models are, for some variables,
> negatively correlated (as indicated by Kendall's tau and Spearman's rho),
> whereas the original observations were positively correlated, leading to
> the copula fitting breaking down (for Gumbel and Clayton copulas, but I
> won't go into copula details, as my question only concerns the output data
> from the 'rugarch' package).
>
> My overall question is, considering my approach and the need for inputting
> fitted parametric marginal distribution functions, are the fitted values
> from the uGARCHfit objects the right input data to be taking further into
> the copula functions? Why are the fitted values negatively correlated, when
> the originals were positively correlated?
>
> I am running everything in RStudio 0.98.501 with R 3.0.2 on Windows 8.1. If
> any further information is needed regarding my system specs or other
> implementation details, let me know and I'll provide them as soon as
> possible.
>
> Thank you very much for your assistance,
> Sebastian
>
> [[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