Mutlvariate GARCH in mean model

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

hl545
Posts: 9
Joined: Thu Aug 27, 2009 7:57 am

Mutlvariate GARCH in mean model

Postby hl545 » Thu Aug 27, 2009 8:19 am

Hi, I am trying to run an estimation of multivariate GARCH in mean model (BEKK) using programming and my code is as follows.
Running the program, I got bug as 'overflow'. I do know some parts of my code are wrong but have no idea where they are and how to get rid of them.
Thanks for helping me to check my code and advise me to modify them!
Attachments
tv_garch - m.prg
(6.99 KiB) Downloaded 593 times

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Mutlvariate GARCH in mean model

Postby trubador » Thu Aug 27, 2009 10:39 am


hl545
Posts: 9
Joined: Thu Aug 27, 2009 7:57 am

Re: Mutlvariate GARCH in mean model

Postby hl545 » Thu Aug 27, 2009 4:43 pm

Hi, thanks for your reply. In fact, I had looked through the one you mentioned before posting my question here. My code is a modification of a sample program of trivariate garch provided by EViews.

For my specific trivariate GARCH in mean model, it includes covariance terms in the mean equation. Thus, I have to deal with such a thorny problem. I hope you could advise me how to get the sample program modified in this case.
Thanks very much!

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Mutlvariate GARCH in mean model

Postby trubador » Thu Aug 27, 2009 10:53 pm

That's exactly what we have done in that post. The only difference is that the modified code estimates a diagonal BEKK. Since you increase the dimension of the model via removing the restrictions, you'll have to adjust the equations accordingly. Comparing this code with the one provided in EViews's sample program directory will give you the idea. However, before moving on towards this direction, you need to learn the functions and programming commands, which you can find useful explanations in help files. This is important, since your code contains some misuses of these commands. For instance, coef is unidimensional like a vector and therefore you cannot define it as a matrix. If the coefficient dimension is (3x3), then you need to assign 9 parameters:

Code: Select all

coef(9) lambda lambda(1) = eq1.c(1) lambda(2) = eq2.c(1) ...

hl545
Posts: 9
Joined: Thu Aug 27, 2009 7:57 am

Re: Mutlvariate GARCH in mean model

Postby hl545 » Sat Aug 29, 2009 8:24 pm

Thanks for you reply, Trubador. in your code from a simple bi-variate garch model, the mean equation is y = mu + H*lambda + res where lambda is a 2 x 1 column vector and H is a 2 x 2 symmetric matrix with H(1,1) and H(2,2) defined as variance of y1 and y2 as well as H(1,2) defined as covariance of y1 and y2. Just one simple question, it is obvious that lambda (1) is the coefficient of the variance of y1 and lambda (2) is the coefficient of the variance of y2 but which one is the coefficient of the covariance of y1 and y2?

In you case, it seems that lambda (2) is the coefficient of the covariance in the first equation but lambda (1) is the one in the second equation, which shows inconsistency with each other any more. I am really confused about that.

In my case, I am keen on estimating the coefficient of the covariance since there is not only variance (garch) term but also covariance term in my mean equation. I have no idea how to get the coefficient of covariance term estimated. In you case, you just estimated lambda for the variance but without the estimate for covariance term.

Thanks very much!

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Mutlvariate GARCH in mean model

Postby trubador » Sun Aug 30, 2009 1:30 am

Off-diagonal elements are multiplied by zero in the case of diagonal BEKK estimation.

hl545
Posts: 9
Joined: Thu Aug 27, 2009 7:57 am

Re: Mutlvariate GARCH in mean model

Postby hl545 » Wed Sep 02, 2009 11:10 am

Thanks for you reply. I spent days modifying my code and got it done finally. I think my code is ok now but it still gets the problem that attempt to raise a negative number to a non integer power in 'OMEGA(1)=(EQ1.C(2))^.5' when I am running it. I have no idea why I got this bug. Thanks very much.
PS: in order to make it clearly, the specification of my mean equation shows in the attachment.

Code: Select all

' ' MV_GARCH-M.PRG ' example program for EViews LogL object ' revised for version 5.0 (8/09/2009) ' ' restricted version of ' Multi-variate BEKK of Engle and Kroner (1995): ' ' y = mu + lambda*g + sigma*y(-1) + res ' res ~ N(0,H) ' ' H = omega*omega' + beta H(-1) beta' + alpha res(-1) res(-1)' alpha' ' ' where, ' y = 3 x 1 ' mu = 3 x 1 ' lambda = 3 x 1 ' sigma = 2 x 3 ' H = 3 x 3 (symmetric) ' H(1,1) = variance of y1 (saved as var_y1) ' H(1,2) = cov of y1 and y2 (saved as cov_y1y2) ' H(1,3) = cov of y1 and y3 (saved as cov_y1y3) ' H(2,2) = variance of y2 (saved as var_y2) ' H(2,3) = cov of y2 and y3 (saved as cov_y2y3) ' H(3,3) = variance of y3 (saved as var_y3) ' g = 3 x 1 ' g(1) = variance of y1 (saved as var_y1) ' g(2) = cov of y1 and y2 (saved as cov_y1y2) ' g(3) = cov of y1 and y3 (saved as cov_y1y3) ' omega = 3 x 3 low triangular ' beta = 3 x 3 diagonal ' alpha = 3 x 3 diagonal ' 'change path to program path '%path = @runpath + "../data/" 'cd %path ' load workfile workfile uk_dy6 ' dependent variables of all series must be continues smpl @all series y1 = log(rets1) -log(interest) series y2 = log(consumption)-log(consumption(-1)) series y3 = log(mkt_return) ' set sample ' first observation of s1 needs to be two periods after ' the first observation of s0 sample s0 @first @last-5 sample s1 @first+2 @last-5 ' initialization of parameters and starting values ' change below only to change the specification of model smpl s0 'get starting values from univariate models equation eq1.arch(archm=var,m=100,c=1e-5) y1 c equation eq2.ls y2 c y1(-1) y2(-1) y3(-1) equation eq3.ls y3 c y1(-1) y2(-1) y3(-1) 'save the conditional variances eq1.makegarch garch1 ' declare coef vectors to use in GARCH model coef(3) mu mu(1) = eq1.c(1) mu(2) = eq2.c(1) mu(3) = eq2.c(1) coef(6) omega omega(1) = (eq1.c(2))^.5 omega(2) = 0 omega(3) = 0 omega(4) = (eq2.c(2))^.5 omega(5) = 0 omega(6) = (eq3.c(2))^.5 coef(3) alpha alpha(1) = (eq1.c(3))^.5 alpha(2) = (eq2.c(3))^.5 alpha(3) = (eq2.c(3))^.5 coef(3) beta beta(1) = (eq1.c(4))^.5 beta(2) = (eq2.c(4))^.5 beta(3) = (eq3.c(4))^.5 coef(3) lambda lambda(1) = - 0.5 lambda(2) = 0 lambda(3) = 0 coef(3) sigma sigma(1) = 0 sigma(2) = 0 sigma(3) = 0 sigma(4) = 0 sigma(5) = 0 sigma(6) = 0 ' use sample var-cov as starting value of variance-covariance matrix series cov_y1y2 = @cov(y1-mu(1)-lambda(1)*garch1, y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1)) series cov_y1y3 = @cov(y1-mu(1)-lambda(1)*garch1, y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1)) series cov_y2y3 = @cov(y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1), y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1)) series var_y1 = @var(y1-mu(1)-lambda(1)*garch1) series var_y2 = @var( y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1)) series var_y3 = @var( y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1)) series sqres1 = (y1-mu(1)-lambda(1)*garch1)^2 series sqres2 = (y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1))^2 series sqres3 = (y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1))^2 series res1res2 = (y1-mu(1)-lambda(1)*garch1)*(y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1)) series res1res3 = (y1-mu(1)-lambda(1)*garch1)*(y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1)) series res2res3 = (y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1))*(y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1)) ' constant adjustment for log likelihood !mlog2pi = 3*log(2*@acos(-1)) ' ........................................................... ' LOG LIKELIHOOD ' set up the likelihood ' 1) open a new blank likelihood object name mvgarch ' 2) specify the log likelihood model by Hao ' ........................................................... logl mvgarch Hao ' squared errors and cross errors mvgarch.Hao @logl logl mvgarch.Hao sqres1 = (y1-mu(1)+0.5*var_y1-lambda(2)* cov_y1y2-lamba(3)* cov_y1y3)^2 mvgarch.Hao sqres2 = (y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1))^2 mvgarch.Hao sqres3 = (y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1))^2 mvgarch.Hao res1res2 = (y1-mu(1)+0.5*var_y1-lambda(2)* cov_y1y2-lamba(3)* cov_y1y3)*(y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1)) mvgarch.Hao res1res3 = (y1-mu(1)+0.5*var_y1-lambda(2)* cov_y1y2-lamba(3)* cov_y1y3)*(y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1)) mvgarch.Hao res2res3 = (y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1))*(y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1)) ' variance and covariance series mvgarch.Hao var_y1 = omega(1)^2 + beta(1)^2*var_y1(-1) + alpha(1)^2*sqres1(-1) mvgarch.Hao var_y2 = omega(2)^2+omega(4)^2 + beta(2)^2*var_y2(-1) + alpha(2)^2*sqres2(-1) mvgarch.Hao var_y3 = omega(3)^2+omega(5)^2+omega(6)^2 + beta(3)^2*var_y3(-1) + alpha(3)^2*sqres3(-1) mvgarch.Hao cov_y1y2 = omega(1)*omega(2) + beta(2)*beta(1)*cov_y1y2(-1) + alpha(2)*alpha(1)*res1res2(-1) mvgarch.Hao cov_y1y3 = omega(1)*omega(3) + beta(3)*beta(1)*cov_y1y3(-1) + alpha(3)*alpha(1)*res1res3(-1) mvgarch.Hao cov_y2y3 = omega(2)*omega(3) + omega(4)*omega(5) + beta(3)*beta(2)*cov_y2y3(-1) + alpha(3)*alpha(2)*res2res3(-1) ' determinant of the variance-covariance matrix mvgarch.Hao deth = var_y1*var_y2*var_y3 - var_y1*cov_y2y3^2-cov_y1y2^2*var_y3+2*cov_y1y2*cov_y2y3*cov_y1y3-cov_y1y3^2*var_y2 ' calculate the elements of the inverse of var_cov (H) matrix ' numbered as vech(inv(H)) mvgarch.Hao invh1 = (var_y2*var_y3-cov_y2y3^2)/deth mvgarch.Hao invh2 = -(cov_y1y2*var_y3-cov_y1y3*cov_y2y3)/deth mvgarch.Hao invh3 = (cov_y1y2*cov_y2y3-cov_y1y3*var_y2)/deth mvgarch.Hao invh4 = (var_y1*var_y3-cov_y1y3^2)/deth mvgarch.Hao invh5 = -(var_y1*cov_y2y3-cov_y1y2*cov_y1y3)/deth mvgarch.Hao invh6 = (var_y1*var_y2-cov_y1y2^2)/deth ' log-likelihood series mvgarch.Hao logl = -0.5*(!mlog2pi + (invh1*sqres1+invh4*sqres2+invh6*sqres3 +2*invh2*res1res2 +2*invh3*res1res3+2*invh5*res2res3 ) + log(deth)) ' remove some of the intermediary series 'mvgarch.Hao @temp invh1 invh2 invh3 invh4 invh5 invh6 sqres1 sqres2 sqres3 res1res2 res1res3 res2res3 deth ' estimate the model smpl s1 mvgarch.ml(showopts, m=100, c=1e-5) ' change below to display different output show mvgarch.output graph var.line var_y1 var_y2 var_y3 graph cov.line cov_y1y2 cov_y1y3 cov_y2y3 show var show cov 'estimate univariate models using same sample as multirivariate model smpl s1 equation eq1.arch(archm=var,m=100,c=1e-5) y1 c equation eq2.ls y2 c y1(-1) y2(-1) y3(-1) equation eq3.ls y3 c y1(-1) y2(-1) y3(-1) ' LR statistic for univariate vs trivariate scalar lr = -2*(eq1.@logl + eq2.@logl + eq3.@logl - mvgarch.@logl) scalar lr_pval = 1 - @cchisq(lr,3)
Attachments
Mean Equation.doc
(17 KiB) Downloaded 526 times

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Mutlvariate GARCH in mean model

Postby trubador » Wed Sep 02, 2009 11:20 am

This is because the estimated value of the coefficient is negative and therefore square root creates error. One remedy is to take the absolute value prior to taking the square root:

Code: Select all

omega(1) = @sqrt(@abs(eq1.c(2)))

hl545
Posts: 9
Joined: Thu Aug 27, 2009 7:57 am

Re: Mutlvariate GARCH in mean model

Postby hl545 » Thu Sep 03, 2009 3:42 am

Hi, Trubador, thanks for your reply and it worked on the edited workfile based on your advice. However, there is one more problem that Missing values in @LOGL series at current coefficients at observation 1965Q4 in ‘DO_MVGARCH.ML(SHOWOPTS,M=100,C=1E-5)’ in my code. I guess that it is connected to adjusting sample period but have no idea how to modify it in my case. Could you give me a piece of advice about the solution of this problem? Thanks!

My modification code is

Code: Select all

' MV_GARCH-M.PRG ' example program for EViews LogL object ' revised for version 5.0 (8/09/2009) ' ' restricted version of ' Multi-variate BEKK of Engle and Kroner (1995): ' ' y = mu + lambda*g + sigma*y(-1) + res ' res ~ N(0,H) ' ' H = omega*omega' + beta H(-1) beta' + alpha res(-1) res(-1)' alpha' ' ' where, ' y = 3 x 1 ' mu = 3 x 1 ' lambda = 3 x 1 ' sigma = 2 x 3 ' H = 3 x 3 (symmetric) ' H(1,1) = variance of y1 (saved as var_y1) ' H(1,2) = cov of y1 and y2 (saved as cov_y1y2) ' H(1,3) = cov of y1 and y3 (saved as cov_y1y3) ' H(2,2) = variance of y2 (saved as var_y2) ' H(2,3) = cov of y2 and y3 (saved as cov_y2y3) ' H(3,3) = variance of y3 (saved as var_y3) ' g = 3 x 1 ' g(1) = variance of y1 (saved as var_y1) ' g(2) = cov of y1 and y2 (saved as cov_y1y2) ' g(3) = cov of y1 and y3 (saved as cov_y1y3) ' omega = 3 x 3 low triangular ' beta = 3 x 3 diagonal ' alpha = 3 x 3 diagonal ' 'change path to program path '%path = @runpath + "../data/" 'cd %path ' load workfile workfile uk_dy6 ' dependent variables of all series must be continues smpl @all series y1 = log(rets1) -log(interest) series y2 = log(consumption)-log(consumption(-1)) series y3 = log(mkt_return) ' set sample ' first observation of s1 needs to be two periods after ' the first observation of s0 sample s0 @first @last-5 sample s1 @first+2 @last-5 ' initialization of parameters and starting values ' change below only to change the specification of model smpl s0 'get starting values from univariate models equation eq1.arch(archm=var,m=100,c=1e-5) y1 c equation eq2.ls y2 c y1(-1) y2(-1) y3(-1) equation eq3.ls y3 c y1(-1) y2(-1) y3(-1) 'save the conditional variances eq1.makegarch garch1 ' declare coef vectors to use in GARCH model coef(3) mu mu(1) = eq1.c(1) mu(2) = eq2.c(1) mu(3) = eq2.c(1) coef(6) omega omega(1) = @sqrt(@abs(eq1.c(2))) omega(2) = 0 omega(3) = 0 omega(4) = @sqrt(@abs(eq1.c(2))) omega(5) = 0 omega(6) = @sqrt(@abs(eq1.c(2))) coef(3) alpha alpha(1) = (eq1.c(3))^.5 alpha(2) = (eq2.c(3))^.5 alpha(3) = (eq2.c(3))^.5 coef(3) beta beta(1) = @sqrt(@abs(eq1.c(4))) beta(2) = @sqrt(@abs(eq1.c(4))) beta(3) = @sqrt(@abs(eq1.c(4))) coef(3) lambda lambda(1) = - 0.5 lambda(2) = 0 lambda(3) = 0 coef(6) sigma sigma(1) = 0 sigma(2) = 0 sigma(3) = 0 sigma(4) = 0 sigma(5) = 0 sigma(6) = 0 ' use sample var-cov as starting value of variance-covariance matrix series cov_y1y2 = @cov(y1-mu(1)-lambda(1)*garch1, y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1)) series cov_y1y3 = @cov(y1-mu(1)-lambda(1)*garch1, y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1)) series cov_y2y3 = @cov(y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1), y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1)) series var_y1 = @var(y1-mu(1)-lambda(1)*garch1) series var_y2 = @var( y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1)) series var_y3 = @var( y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1)) series sqres1 = (y1-mu(1)-lambda(1)*garch1)^2 series sqres2 = (y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1))^2 series sqres3 = (y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1))^2 series res1res2 = (y1-mu(1)-lambda(1)*garch1)*(y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1)) series res1res3 = (y1-mu(1)-lambda(1)*garch1)*(y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1)) series res2res3 = (y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1))*(y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1)) ' constant adjustment for log likelihood !mlog2pi = 3*log(2*@acos(-1)) ' ........................................................... ' LOG LIKELIHOOD ' set up the likelihood ' 1) open a new blank likelihood object name mvgarch ' 2) specify the log likelihood model by append ' ........................................................... logl mvgarch Hao ' squared errors and cross errors mvgarch.append @logl logl mvgarch.append sqres1 = (y1-mu(1)+0.5*var_y1-lambda(2)* cov_y1y2-lambda(3)* cov_y1y3)^2 mvgarch.append sqres2 = (y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1))^2 mvgarch.append sqres3 = (y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1))^2 mvgarch.append res1res2 = (y1-mu(1)+0.5*var_y1-lambda(2)*cov_y1y2-lambda(3)*cov_y1y3)*(y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1)) mvgarch.append res1res3 = (y1-mu(1)+0.5*var_y1-lambda(2)*cov_y1y2-lambda(3)*cov_y1y3)*(y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1)) mvgarch.append res2res3 = (y2-mu(2)-sigma(1)*y1(-1)-sigma(2)*y2(-1)-sigma(3)*y3(-1))*(y3-mu(3)-sigma(4)*y1(-1)-sigma(5)*y2(-1)-sigma(6)*y3(-1)) ' variance and covariance series mvgarch.append var_y1 = omega(1)^2 + beta(1)^2*var_y1(-1) + alpha(1)^2*sqres1(-1) mvgarch.append var_y2 = omega(2)^2+omega(4)^2 + beta(2)^2*var_y2(-1) + alpha(2)^2*sqres2(-1) mvgarch.append var_y3 = omega(3)^2+omega(5)^2+omega(6)^2 + beta(3)^2*var_y3(-1) + alpha(3)^2*sqres3(-1) mvgarch.append cov_y1y2 = omega(1)*omega(2) + beta(2)*beta(1)*cov_y1y2(-1) + alpha(2)*alpha(1)*res1res2(-1) mvgarch.append cov_y1y3 = omega(1)*omega(3) + beta(3)*beta(1)*cov_y1y3(-1) + alpha(3)*alpha(1)*res1res3(-1) mvgarch.append cov_y2y3 = omega(2)*omega(3) + omega(4)*omega(5) + beta(3)*beta(2)*cov_y2y3(-1) + alpha(3)*alpha(2)*res2res3(-1) ' determinant of the variance-covariance matrix mvgarch.append deth = var_y1*var_y2*var_y3 - var_y1*cov_y2y3^2-cov_y1y2^2*var_y3+2*cov_y1y2*cov_y2y3*cov_y1y3-cov_y1y3^2*var_y2 ' calculate the elements of the inverse of var_cov (H) matrix ' numbered as vech(inv(H)) mvgarch.append invh1 = (var_y2*var_y3-cov_y2y3^2)/deth mvgarch.append invh2 = -(cov_y1y2*var_y3-cov_y1y3*cov_y2y3)/deth mvgarch.append invh3 = (cov_y1y2*cov_y2y3-cov_y1y3*var_y2)/deth mvgarch.append invh4 = (var_y1*var_y3-cov_y1y3^2)/deth mvgarch.append invh5 = -(var_y1*cov_y2y3-cov_y1y2*cov_y1y3)/deth mvgarch.append invh6 = (var_y1*var_y2-cov_y1y2^2)/deth ' log-likelihood series mvgarch.append logl = -0.5*(!mlog2pi + (invh1*sqres1+invh4*sqres2+invh6*sqres3 +2*invh2*res1res2 +2*invh3*res1res3+2*invh5*res2res3 ) + log(deth)) ' remove some of the intermediary series 'mvgarch.append @temp invh1 invh2 invh3 invh4 invh5 invh6 sqres1 sqres2 sqres3 res1res2 res1res3 res2res3 deth ' estimate the model smpl s1 mvgarch.ml(showopts, m=100, c=1e-5) ' change below to display different output show mvgarch.output graph var.line var_y1 var_y2 var_y3 graph cov.line cov_y1y2 cov_y1y3 show var show cov 'estimate univariate models using same sample as multirivariate model smpl s1 equation eq1.arch(archm=var,m=100,c=1e-5) y1 c equation eq2.ls y2 c y1(-1) y2(-1) y3(-1) equation eq3.ls y3 c y1(-1) y2(-1) y3(-1) ' LR statistic for univariate vs trivariate scalar lr = -2*(eq1.@logl + eq2.@logl + eq3.@logl - mvgarch.@logl) scalar lr_pval = 1 - @cchisq(lr,3)

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Mutlvariate GARCH in mean model

Postby trubador » Thu Sep 03, 2009 5:52 am

I guess, this is the first observation in your model. If that is the case, then the problem may be due to your sample period. You should better go over the following piece of your code carefully:
' set sample
' first observation of s1 needs to be two periods after
' the first observation of s0
sample s0 @first @last-5
sample s1 @first+2 @last-5


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest