# Re: [R] Generalized DCC GARCH ML estimation

From: Matthieu Stigler <matthieu.stigler_at_gmail.com>
Date: Mon, 07 Jun 2010 17:19:13 +0200

Dear Anonymous

I suggest you to have a look on the code in package ccgarch, which might help you in seeing how this have been done. A useful information would be to know what kind of optimization algorithm the authors use.

best

Matthieu

Le 07. 06. 10 12:00, r-help-request_at_r-project.org a écrit :
> Message: 24
> Date: Sun, 6 Jun 2010 10:17:50 -0700 (PDT)
> From: drinky_1<Benno_Haydl_at_web.de>
> To:r-help_at_r-project.org
> Subject: [R] Generalized DCC GARCH ML estimation
> Message-ID:<1275844670290-2245135.post@n4.nabble.com>
> Content-Type: text/plain; charset=us-ascii
>
>
> Hi everyone,
>
> I want to do a maximum likelihood estimation for the Generalized Dynamic
> Conditional Correlation (GDCC) Model of Hafner and Franses (2009), but I
> don't know how exactly. I hope you can help me. This is what I have so far.
>
> Well first of all Hafner models the conditional covariance matrix H_t as
> follows:
> H=D*R*D, where D is a diagonal matrix with the square root of the estimated
> univariate GARCH variances, R is a correlation matrix:
> R_t=diag(Q_t)^(-1/2)*Q_t*diag(Q_t)^(-1/2) and
> Q_t=S(1-mean(a)2-mean(b)2)+ aa' * (eps_(t-1)*eps')+ bb'*Q_(t-1)
>
> a and b are parameter vectors and S is the sample correlation matrix of the
> eps.
>
> There is a two-step estimation method, but I only need the second step.
>
> So first of all I want to calculate the correlations
>
> gdcc=function (dvar,alpha,beta)
> {
>
> T=dim(dvar)
> N=dim(dvar)
>
> uncR=cor(dvar)
> R=list()
>
> Q=list()
> Q[]=uncR
> R[]=diag(diag(uncR)^(-1/2))%*%uncR%*%diag(diag(uncR)^(-1/2))
>
>
> for (i in 2:T)
> {
>
> Q[[i]]=uncR*(1-mean(alpha)2-mean(beta)2)+tcrossprod(alpha)*tcrossprod(dvar[i-1,])+tcrossprod(beta)*Q[[i-1]]
>
>
> R[[i]]=diag(diag(Q[[i]])^(-1/2))%*%Q[[i]]%*%diag(diag(Q[[i]])^(-1/2))
>
> GDCC[i,]=as.vector(R[[i]])
> }
>
> GDCC
> }
>
> and the log-likelihood function is as follows:
>
> loglik.gdcc2=function (alpha,beta,dvar)
> {
> T<- dim(dvar)
> N<- dim(dvar)
> GDCC=gdcc(dvar,alpha,beta)
> lf<- numeric(N)
> for (i in 1:T) {
> R<- matrix(GDCC[i,], N, N)
> invR<- solve(R)
> lf[i]<- 0.5 * (log(det(R)) + sum(dvar[i, ] * crossprod(invR,
> dvar[i, ])))
> }
> -sum(lf)
>
> }
>
> I want to use the nlm method. How can I estimate the parameter vectors a and
> b? I really would appreciate it if anyone could help me.
>
> Thank you very much.
> Best regards, drinky_1
>

[[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 07 Jun 2010 - 15:22:49 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 07 Jun 2010 - 15:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.