Hi
My name is Jones and a new user of eviews. I have been trying to estimate a Multivariate EGARCH model to analyse the spillover effect across different stock markets. I have searched the entire forum but haven't com across any code for such estimation. Would kindly like to request , if any has written the code and will like to share. Its quite urgent please.
Thanks
Multivariate EGARCH
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
yixiaoyang
- Posts: 1
- Joined: Wed May 02, 2012 2:32 am
Re: Multivariate EGARCH
Code: Select all
'set sample
pagestruct(start=3/30/2010, end=9/14/2011) *
smpl @all
series y1=dlog(ap)
series y2=dlog(hp*exc)
sample s1 3/30/2010 9/14/2011
sample s2 4/2/2010 9/14/2011
'set series
'declare coefficients
coef(2) beta0
beta0(1)=0.001
beta0(2)=0.001
coef(4) beta
beta(1)=-0.2
beta(2)=0.3
beta(3)=0.2
beta(4)=-0.2
coef(2) lambda
lambda(1)=0.2
lambda(2)=0.2
coef(2) alpha0
alpha0(1)=0.001
alpha0(2)=0.001
coef(2) gamma
gamma(1)=0.5
gamma(2)=0.5
coef(4) alpha
alpha(1)=0.001
alpha(2)=0.3
alpha(3)=0.001
alpha(4)=0.2
coef(2) delta
delta(1)=-0.1
delta(2)=-0.01
coef(2) ef
ef(1)=0.2
ef(2)=0.1
coef(1) c0
c0(1)=0.01
coef(1) ci
ci(1)=0.04
coef(1) g
g(1)=0.7
coef(9) dum
'dum(1)=0.001 'beta(2)
'dum(2)=0.001 'lambda(1)
'dum(3)=0.001 'beta(3)
'dum(4)=0.001 'lambda(2)
'dum(5)=0.001 'alppha(2)
'dum(6)=0.001 'ef(1)
'dum(7)=0.001 'alpha(4)
'dum(8)=0.001 'ef(2)
'dum(9)=0.001 'c(1)
!pi = @acos(-1)
!absz=sqr(2/!pi)
'set presample values of expressions in logl
smpl s1
series res1=y1-beta0(1)-beta(1)*y1(-1)-beta(2)*y2(-1)
series res2=y2-beta0(2)-(beta(3))*y1(-1)-beta(4)*y2(-1)
!var1=(@stdev(res1))^2
!var2=(@stdev(res2))^2
!correlation=@cor(y1,y2)
series h11=!var1
series h22=!var2
series rho=!correlation
series h12=2*rho*sqr(h11)*sqr(h22)
series deth=h11*h22-h12*h12
series invh11=h22/deth
series invh12=-h12/deth
series invh22=h11/deth
'set up EGARCH likelihood
smpl s2
logl ll1
ll1.append @logl logl @byeqn
ll1.append res1=y1-beta0(1)-beta(1)*y1(-1)-beta(2)*y2(-1)
ll1.append res2=y2-beta0(2)-beta(3)*y1(-1)-beta(4)*y2(-1)
ll1.append h11=exp(alpha0(1)+gamma(1)*log(h11(-1))+alpha(1)*(abs(res1(-1)/sqr(h11(-1)))-!absz+delta(1)*((res1(-1)/sqr(h11(-1)))))+alpha(2)*(abs(res2(-1)/sqr(h22(-1)))-!absz+delta(2)*((res2(-1)/sqr(h22(-1))))))
ll1.append h22=exp(alpha0(2)+gamma(2)*log(h22(-1))+alpha(3)*(abs(res2(-1)/sqr(h22(-1)))-!absz+delta(2)*((res2(-1)/sqr(h22(-1)))))+(alpha(4))*(abs(res1(-1)/sqr(h11(-1)))-!absz+delta(1)*((res1(-1)/sqr(h11(-1))))))
ll1.append rho=@cor(res1,res2)
ll1.append h12=rho*sqr(h11)*sqr(h22)
ll1.append deth=h11*h22-h12*h12
ll1.append invh11=h22/deth
ll1.append invh12=-h12/deth
ll1.append invh22=h11/deth
ll1.append likelihoods=log(deth)+(res1^2)*invh11+(res2^2)*invh22+2*res1*res2*invh12
ll1.append logl=-log(2*!pi)-0.5*likelihoods
ll1.append z1=res1/sqr(h11)
ll1.append z2=res2/sqr(h22)
ll1.append z11=(res1^2)/h11
ll1.append z22=(res2^2)/h22
ll1.append z12=z1*z2
' estimate and display output
smpl s2
ll1.ml(showopts,m=100,c=1e-5)
show ll1.output-
garchiemanning
- Posts: 7
- Joined: Fri Apr 13, 2012 9:00 am
Re: Multivariate EGARCH
Might be a fun idea to alter the correlation function to allow conditional corr (DCC). I'll see what I come up with.
Re: Multivariate EGARCH
Can anyone tell me if this code is valid . and can you make it to the bivariate version?
Who is online
Users browsing this forum: No registered users and 2 guests
