bekk model with dummy

Discussions of ARCH, GARCH, and related models
Qatar
Posts: 4
Joined: Tue Sep 24, 2013 9:28 am

bekk model with dummy

Unread post by Qatar »

Hi

I'm trying to replicate a paper Beirne (2008) https://www.imf.org/external/pubs/ft/wp ... p08286.pdf
on volatility spillover and cointegration from mature to emerging markets, but I'm adding a few breaks.

Code: Select all

OPEN DATA "C:\marketmaturetoemerging"
DATA(FORMAT=PRN,ORG=COLUMNS) 1 4414 market1 maret2 control

set y1 = market1*100
set y2 = market2*100
set y3 = control*100

COMPUTE GSTART = 9 , GEND = 4406
SET DUMMY1 = T>=2074.AND.T<=4406
SET DUMMY2 = T>=1624.AND.T<=5506
SET DUMMY3 = T>=2185.AND.T<=4406
SET DUMMY4 = T>=2478.AND.T<=4406

NONLIN a11 B12 b11 b12st  b12st2  b12st3  b12st4 s1 s2                    
NONLIN B21 a22  b22 b21st b21st2   b21st3  b21st4  

FRML RESID1 = (Y1-a11-(B12+B12st*dummy1+B12st2*dummy2+B12st3*dummy3+B12st4*dummy4)*Y2{1}-B11*Y1{1}-s1*y3{1})
FRML RESID2 = (Y2-a22-(B21+b21st*dummy1+b21st2*dummy2+b21st3*dummy3+b21st4*dummy4)*Y1{1}-B22*Y2{1}-s2*y3{1})
LINREG Y1 / R1
# CONSTANT
cOMPUTE B11 = %BETA(1)
COMPUTE B12 = %BETA(2)
COMPUTE B12st = %BETA(3)
COMPUTE B12st2 = %BETA(4)
COMPUTE B12st3 = %BETA(5)
COMPUTE B12st4 = %BETA(6)
COMPUTE a11 = %BETA(7)
COMPUTE s1 = %BETA(8)

LINREG Y2 / R2
# CONSTANT

COMPUTE B21 = %BETA(1)
COMPUTE B22 = %BETA(2)
COMPUTE B21st = %BETA(3)
COMPUTE B21st2 = %BETA(4)
COMPUTE B21st3 = %BETA(5)
COMPUTE B21st4 = %BETA(6)
COMPUTE a22 = %BETA(7)
COMPUTE s2 = %BETA(8)
VCV(MATRIX=RR,NOPRINT)
# R1 R2
DECLARE SERIES U1 U2
DECLARE SERIES H11 H12 H22
SET U1 = R1
SET U2 = R2
SET H11 = RR(1,1)
SET H22 = RR(2,2)
SET H12 = RR(1,2)
DECLARE SYMMETRIC H
DECLARE VECTOR    U
DECLARE FRML      H11F H22F H12F
FRML LOGL = $
H11(T)= H11F(T)   , H22(T)=H22F(T) , H12(T)=H12F(T) , $
U1(T) = RESID1(T) , U2(T) = RESID2(T) , $
H = ||H11(T)|H12(T),H22(T)|| , $
U = ||U1(T),U2(T)||, $
%LOGDENSITY(H,U)
NONLIN b11 b12 a11 b12st  b12st2  b12st3  b12st4  s1 s2               
NONLIN(ADD) b21 a22  b22 b21st b21st2   b21st3  b21st4
NONLIN(ADD) VC11 VC12 VC22 VA11 VA12 va21 VA22 VB11 VB12 vb21 VB22 VA12st  VB12st VA21st VB21st VA12st2  VB12st2 VA21st2 VB21st2 VA12st3  VB12st3 VA21st3 VB21st3  VA12st4  VB12st4 VA21st4 VB21st4
FRML H11F = (VC=||VC11,VC12|0.0,VC22||),$
  (VA=|| VA11 , VA12 + dummy1*VA12st + dummy2*VA12st2 + dummy3*VA12st3 + dummy4*VA12st4 | VA21 + dummy1*VA21st+ dummy2*VA21st2+ dummy3*VA21st3 + dummy4*VA21st4, VA22||),$
  (VB=|| VB11 , VB12 + dummy1*VB12st + dummy2*VB12st2 + dummy3*VB12st3 + dummy4*VB12st4 | VB21 + dummy1*VB21st+ dummy2*VB21st2+ dummy3*VB21st3 + dummy4*VB21st4, VB22||),$
  (H=||H11{1}|H12{1},H22{1}||),$
  (UB=||U1{1},U2{1}||*VB),$
  (H=TR(VC)*VC+%MQFORM(H,VA)+TR(UB)*UB),$
  H(1,1)
FRML H12F = H(1,2)
FRML H22F = H(2,2)
COMPUTE CINIT = %DECOMP(RR)
COMPUTE VC11=CINIT(1,1) , VC12 = CINIT(1,2) , VC22=CINIT(2,2)
COMPUTE VA11 = VA21 = VA22 = 0.05, VA12 = 0.05
compute VB11 = VB21 = VB22 = 0.05, VB12 = 0.05
COMPUTE VB12st =  VA12st = VB21st =  VA21st = 0.05
compute VB12st2 =  VA12st2 = VB21st2 =  VA21st2 = 0.05
COMPUTE VB12st3 =  VA12st3 = VB21st3 =  VA21st3 = 0.05
compute VB12st4 =  VA12st4 = VB21st4 =  VA21st4 = 0.05
COMPUTE B11 = B12 =  B21 = B22 = a11 = a22 = b12st = b21st = b12st2 = b21st2 = b12st3 = b21st3 = b12st4 = b21st4 =  s1 = s2 =0.05
NLPAR(SUBITERATIONS=50)
MAXIMIZE(METHOD=SIMPLEX,ITERS=30,noprint) LOGL GSTART GEND
MAXIMIZE(METHOD=BFGS,ROBUST,RECURSIVE,ITERS=200) LOGL GSTART GEND
set unorm1 GSTART GEND = u1/sqrt(H11F)
set unorm2 GSTART GEND = u2/sqrt(H22F)
set usqnorm1 GSTART GEND = unorm1**2
set usqnorm2 GSTART GEND = unorm2**2
set concor = H12F/(sqrt(H11F)*sqrt(H22F))
TEST(ZEROS)
# 1

@bdindtests(number=10) unorm1 
@bdindtests(number=10) usqnorm1 
@bdindtests(number=10) unorm2 
@bdindtests(number=10) usqnorm2 


@ARCHtest(lags=10,span=1) unorm1
@ARCHtest(lags=10,span=1) unorm2


@westchotest(number=10) unorm1
@westchotest(number=10) usqnorm1
@westchotest(number=10) unorm2
@westchotest(number=10) usqnorm2

linreg usqnorm1
# constant usqnorm1{1 to 10}
exclude(title="ARCH Test: F Variant")
# usqnorm1{1 to 10}
exclude
# usqnorm1{3 to 10}
cdf(title="ARCH Test: Chi-Squared Variant") chisqr %trsquared 10


I get good q statistics on the 1st variable (market 1 ) however I get very big volatility clustering q statistics and arch effects in the model in (market 2).
I'm sure it's something wrong with the code because I changed the data set and still get these strange results.

Could you please guide me on how to correct this code. Many thanks in advance

Kind Regards
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: bekk model with dummy

Unread post by TomDoan »

You need to attach the data file as well.
Qatar
Posts: 4
Joined: Tue Sep 24, 2013 9:28 am

Re: bekk model with dummy

Unread post by Qatar »

Dear Tom;

Attached is the file

Thanks for your quick reply. Many thanks in advance for your help
Attachments
marketmaturetoemerging.txt
market1, market2, control
(159.78 KiB) Downloaded 1077 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: bekk model with dummy

Unread post by TomDoan »

You're basing that on some rather old RATS code---I've attached a cleaned up version of that.

Your original model wasn't fully converged (you were doing too many simplex iterations, and were limiting the iterations to 200 on the main estimation). However, it looks like the model doesn't fully explain the residuals for the 2nd series.

I would note, however, that they are doing a modified TBEKK model while you're doing a modified full BEKK model.
Attachments
dummygarch.rpf
(3.2 KiB) Downloaded 1122 times
Qatar
Posts: 4
Joined: Tue Sep 24, 2013 9:28 am

Re: bekk model with dummy

Unread post by Qatar »

Dear Tom;

Many thanks;

can you kindly advice me how to make the model fully explain the residuals for the 2nd series, because I switched the two markets and I alwayse get extremely high residuals for the second coefficient, even if they are the same coefficients just the other way around.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: bekk model with dummy

Unread post by TomDoan »

A couple of problems. You're parameterizing the constant in the variance as an upper triangular matrix, but initializing it using a lower triangular decomposition. You need to put the tr(..) on the CINIT definition as shown here:

COMPUTE CINIT = tr(%DECOMP(%sigma))
COMPUTE VC11=CINIT(1,1) , VC12 = CINIT(1,2) , VC22=CINIT(2,2)

More important---in the below, you were using H11F, H22F, etc. Because of the way you're writing those FRML' that doesn't work---H22F(t) assumes that H11F(t) was just computed at the same time period. You need to use the defined series H11, H22, etc.

set unorm1 GSTART GEND = u1/sqrt(H11)
set unorm2 GSTART GEND = u2/sqrt(H22)
set usqnorm1 GSTART GEND = unorm1**2
set usqnorm2 GSTART GEND = unorm2**2
set concor = H12F/(sqrt(H11)*sqrt(H22))
Qatar
Posts: 4
Joined: Tue Sep 24, 2013 9:28 am

Re: bekk model with dummy

Unread post by Qatar »

I was stuck on this issue for a long time before asking for help in this forum, many thanks a lot for your help
Post Reply