Bi variate GARCH in mean

For questions regarding programming in the EViews programming language.

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

Posts: 9
Joined: Tue Nov 23, 2010 9:49 am

Bi variate GARCH in mean

Postby yaser » Tue Apr 12, 2011 7:31 am

Dear Eviews users:

I have modified the bv_garch.prg of the Eviews6. the model I am working with is a VAR(1) GARCH(1,1) in mean with a 2x2 coefficient matrix of garch in mean elements.
however, it estimates the data set related to workfile intl_fin.wf1 but not mine the corresponding error is owerflow.
I am attaching the aforementioned program and the workfile of mine.
how can I fix it?
appreciate your help in advance.


%path = @runpath
cd %path

load tez.wf1

smpl @all
series y1 = gy
series y2 = gp

sample s0 1367q2 1386q4
sample s1 1367q3
this is the work file which would be rear by the program above
gy=GDP growth- gp=inflation
(9.38 KiB) Downloaded 101 times

smpl s0

equation eq1.arch(archm=var,m=100,c=1e-5) y1 c y1(-1) y2(-1)
equation eq2.arch(archm=var,m=100,c=1e-5) y2 c y1(-1) y2(-1)

eq1.makegarch garch1
eq2.makegarch garch2

coef(4) lambda
lambda(1) = eq1.c(1)
lambda(2) = eq1.c(2)
lambda(3) = eq2.c(1)
lambda(4) = eq2.c(2)
coef(6) mu
mu(1) = eq1.c(3)
mu(2) = eq1.c(4)
mu(3) = eq1.c(5)
mu(4) = eq2.c(3)
mu(5) = eq2.c(4)
mu(6) = eq2.c(5)

coef(3) omega

coef(2) alpha
alpha(1) = (eq1.c(6))^.5
alpha(2) = (eq2.c(6))^.5

coef(2) beta
beta(1)= (eq1.c(7))^.5
beta(2)= (eq2.c(7))^.5

!mlog2pi = 2*log(2*@acos(-1))

series cov_y1y2 = @cov(y1-mu(1)-mu(2)*y1(-1)-MU(3)*y2(-1)-lambda(1)*garch1-lambda(2)*garch2, y2-mu(4)-mu(5)*y1(-1)-MU(6)*y2(-1)-lambda(3)*garch1-lambda(2)*garch2)

series var_y1 = @var(y1-MU(2)*y1(-1)-MU(3)*y2(-1)-lambda(1)*garch1-lambda(2)*garch2)
series var_y2 = @var(y2-MU(5)*y1(-1)-MU(6)*y2(-1)-lambda(3)*garch1-lambda(4)*garch2)

series sqres1 = (y1-mu(1)-MU(2)*y1(-1)-MU(3)*y2(-1)-lambda(1)*garch1-lambda(2)*garch2)^2
series sqres2 = (y2-mu(4)-MU(5)*y1(-1)-MU(6)*y2(-1)-lambda(3)*garch2-lambda(4)*garch2)^2

series res1res2 = (y1-mu(1)-MU(2)*y1(-1)-MU(3)*y2(-1)-lambda(1)*garch1-lambda(2)*garch2)*(y2-mu(4)-MU(5)*y1(-1)-MU(6)*y2(-1)-lambda(3)*garch1-lambda(4)*garch2)

logl bvgarch

bvgarch.append @logl logl
bvgarch.append sqres1 = (y1-mu(1)-MU(2)*y1(-1)-MU(3)*y2(-1)-lambda(1)*garch1-lambda(2)*garch2)^2
bvgarch.append sqres2 = (y2-mu(4)-MU(5)*y1(-2)-MU(6)*y2(-1)-lambda(3)*garch1-lambda(4)*garch2)^2

bvgarch.append res1res2 = (y1-mu(1)-MU(2)*y1(-1)-MU(3)*y2(-1)-lambda(1)*garch1-lambda(2)*garch2)*(y2-mu(4)-MU(5)*y1(-1)-MU(6)*y2(-1)-lambda(3)*garch1-lambda(4)*garch2)

bvgarch.append var_y1 = omega(1)^2 + beta(1)^2*var_y1(-1) + alpha(1)^2*sqres1(-1)
bvgarch.append var_y2 = omega(3)^2+omega(2)^2 + beta(2)^2*var_y2(-1) + alpha(2)^2*sqres2(-1)
bvgarch.append cov_y1y2 = omega(1)*omega(2) + beta(2)*beta(1)*cov_y1y2(-1) + alpha(2)*alpha(1)*res1res2(-1)

bvgarch.append deth = var_y1*var_y2 - cov_y1y2^2

bvgarch.append invh1 = var_y2/deth
bvgarch.append invh3 = var_y1/deth
bvgarch.append invh2 = -cov_y1y2/deth

bvgarch.append logl =-0.5*(!mlog2pi + (invh1*sqres1+2*invh2*res1res2+invh3*sqres2) + log(deth))

smpl s1, m=100, c=1e-5)

show bvgarch.output
graph varcov.line var_y1 var_y2 cov_y1y2
show varcov

scalar lr = -2*( eq1.@logl + eq2.@logl - bvgarch.@logl )
scalar lr_pval = 1 - @cchisq(lr,1)

Return to “Programming”

Who is online

Users browsing this forum: No registered users and 3 guests