Dear Tom,
I friend gave me a Bivariate VAR-EGARCH code and it include endogenous variable with a dummy. I have tried to reduce it to a model for two series variables (withouth the endogenous variable cx and cx_sqrd) and a dummy without success. I would apprecate it if you could help me in this regard
Bivariate VAR-EGARCH with dummy variable
Bivariate VAR-EGARCH with dummy variable
Last edited by gorgorm on Wed Jul 14, 2010 5:35 am, edited 1 time in total.
Re: Bivariate VAR-EGARCH with dummy variable
Your original code for the variance formulas reads:
From your description, it sounds as if you want that to be:
One question would be whether that's how you want the dummy to enter the variance. As written, it's going to be additive. More standard would be to pull it inside the exp(...), that is,
The following will clean up the old code a bit by splitting the parameters into one set for the mean equation and one for the variance equation. It also uses the PMETHOD option on MAXIMIZE so you don't have to do two MAXIMIZE instructions. (The RECURSIVE option on MAXIMIZE is no longer necessary). This takes the third variable out of the mean equations. You'll just have to figure out what you want to do with the dummy in the variance equations.
Code: Select all
frml h11 = $
exp(a10+a11*z1{1}+a12*z2{1}+c1*log(v11{1})+j13*log(sr{1}))+d10*dum{0}
frml h22 = $
exp(a20+a21*z1{1}+a22*z2{1}+c2*log(v22{1})+j23*log(sr{1}))+d20*dum{0}Code: Select all
frml h11 = $
exp(a10+a11*z1{1}+a12*z2{1}+c1*log(v11{1}))+d10*dum{0}
frml h22 = $
exp(a20+a21*z1{1}+a22*z2{1}+c2*log(v22{1}))+d20*dum{0}Code: Select all
frml h11 = $
exp(a10+a11*z1{1}+a12*z2{1}+c1*log(v11{1})+d10*dum{0})
frml h22 = $
exp(a20+a21*z1{1}+a22*z2{1}+c2*log(v22{1})+d20*dum{0})The following will clean up the old code a bit by splitting the parameters into one set for the mean equation and one for the variance equation. It also uses the PMETHOD option on MAXIMIZE so you don't have to do two MAXIMIZE instructions. (The RECURSIVE option on MAXIMIZE is no longer necessary). This takes the third variable out of the mean equations. You'll just have to figure out what you want to do with the dummy in the variance equations.
Code: Select all
nonlin(parmset=meanparms) b10 b11 b12 k10 b20 b21 b22 k20
frml e1 = r1-b10-b11*r1{1}-b12*r2{1}-k10*dum{0}
frml e2 = r2-b20-b21*r1{1}-b22*r2{1}-k20*dum{0}
nonlin(parmset=garchparms) g1 g2 a10 a11 a12 c1 d10 a20 a21 a22 c2 d20 r12
frml z1 = abs(u1(t)/sqrt(v11(t)))-sqrt(2/%pi)+g1*u1(t)/sqrt(v11(t))
frml z2 = abs(u2(t)/sqrt(v22(t)))-sqrt(2/%pi)+g2*u2(t)/sqrt(v22(t))
frml h11 = $
exp(a10+a11*z1{1}+a12*z2{1}+c1*log(v11{1}))+d10*dum{0}
frml h22 = $
exp(a20+a21*z1{1}+a22*z2{1}+c2*log(v22{1}))+d20*dum{0}
frml h12 = r12*sqrt(v11(t)*v22(t))
dec symm sigma
dec vect uvect
frml Lt = $
v11(t)=h11(t), v22(t)=h22(t), $
v12(t)=h12(t), $
u1(t)=e1(t), u2(t)=e2(t), $
sigma= $
||v11(t)|v12(t),v22(t)||, $
uvect=||u1(t),u2(t)||, $
%logdensity(sigma,uvect)
nlsystem(parmset=meanparms) / e1 e2
compute a10=log(%sigma(1,1)), a11=0.07, a12=0.0, g1=0.0, c1=.80, d10=0.0
compute v11(start)=%sigma(1,1), u1(start)=.03
compute a20=log(%sigma(2,2)), a21=0.00, a22=0.5, g2=0.0, c2=.75, d20=0.0
compute v22(start)=%sigma(2,2), u2(start)=.04
compute r12=0.0
nlpar(criterion=value,cvcrit=0.0000001)
maximize(parmset=meanparms+garchparms,pmethod=simplex,piters=2,method=bfgs,iter=2000,trace) Lt start+1 end