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-requ...@r-project.org a écrit :
> Message: 24
> Date: Sun, 6 Jun 2010 10:17:50 -0700 (PDT)
> From: drinky_1<benno_ha...@web.de>
> To:r-help@r-project.org
> Subject: [R] Generalized DCC GARCH ML estimation
> Message-ID:<1275844670290-2245135.p...@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)[1]
> N=dim(dvar)[2]
>
> uncR=cor(dvar)
> R=list()
>
> Q=list()
> Q[[1]]=uncR
> R[[1]]=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)[1]
>      N<- dim(dvar)[2]
>      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@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.

Reply via email to