Page 1 of 1

Multivariate E-GARCH models

Posted: Mon Jul 06, 2009 11:06 am
by Markus86
I am trying to estimate a multivariate (4x4) EGARCH for a set of return series. I have previously done all my work in E-views (M.Sc.) and this is my first project in RATS. I am trying to modify a RATS code that I got during a course in Volatility modelling. Unfortunately, when I try to run the code I get the following error message:

## SR10. Missing Values And/Or SMPL Options Leave No Usable Data Points

The code looks like this:

Code: Select all

cal(daily) 1999 1 1 5
allocate 2004:03:23
open data h:\vm09\data\ew_rats\vm09.rat
data(format=rats) / r_eur r_ftseas r_cdax rt_cdax
set r1 1999:1:4 2004:03:23 = r_eur
set r2 1999:1:4 2004:03:23 = r_ftseas
set r3 1999:1:4 2004:03:23 = r_cdax
set r4 1999:1:4 2004:03:23 = rt_cdax
compute start=1999:1:4, end=2004:03:23

nonlin b10 b11 b12 b13 b14 b20 b21 b223 b23 b24 $
b30 b31 b32 b33 b34 $
b40 b41 b42 b43 b44 $
b442 b443 b444 b445 $
a10 a11 a12 a13 a14 a20 a21 a22 a23 a24 a30 a31 a32 a33 a34 $
a40 a41 a42 a43 a44 g1 g2 g3 g4 c1 c2 c3 c4 c32 c42 c43 $
r12 r13 r14 r23 r24 r34

set u1 = 0.0
set u2 = 0.0
set u3 = 0.0
set u4 = 0.0

set v11 = 0.0
set v22 = 0.0
set v33 = 0.0
set v44 = 0.0

set v12 = 0.0
set v13 = 0.0
set v14 = 0.0
set v23 = 0.0
set v24 = 0.0
set v34 = 0.0

frml e1 = r1-b10-b11*r1{1}-b12*r2{1}-b13*r3{1}-b14*r4{1}
frml e2 = r2-b20-b21*r1{1}-b223*r2{3}-b23*r3{1}-b24*r4{1}
frml e3 = r3-b30-b31*r1{1}-b32*r2{1}-b33*r3{1}-b34*r4{1}
frml e4 = r4-b40-b41*r1{1}-b42*r2{1}-b43*r3{1}-b44*r4{1}-b442*r4{2}-b443*r4{3} $
-b444*r4{4}-b445*r4{5}

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 z3 = abs(u3(t)/sqrt(v33(t)))-sqrt(2/%pi)+g3*u3(t)/sqrt(v33(t))
frml z4 = abs(u4(t)/sqrt(v44(t)))-sqrt(2/%pi)+g4*u4(t)/sqrt(v44(t))

frml h11 = $
exp(a10+a11*z1{1}+a12*z2{1}+a13*z3{1}+a14*z4{1}+c1*log(v11{1}))
frml h22 =  $
exp(a20+a21*z1{1}+a22*z2{1}+a23*z3{1}+a24*z4{1}+c2*log(v22{1}))
frml h33 =  $
exp(a30+a31*z1{1}+a32*z2{1}+a33*z3{1}+a34*z4{1}+c3*log(v33{1})+c32*log(v33{2}))
frml h44 =  $
exp(a40+a41*z1{1}+a42*z2{1}+a43*z3{1}+a44*z4{1}+c4*log(v44{1})+c42*log(v44{2})+c43*log(v44{3}))

frml h12 = r12*sqrt(v11(t)*v22(t))
frml h13 = r13*sqrt(v11(t)*v33(t))
frml h14 = r14*sqrt(v11(t)*v44(t))
frml h23 = r23*sqrt(v22(t)*v33(t))
frml h24 = r24*sqrt(v22(t)*v44(t))
frml h34 = r34*sqrt(v33(t)*v44(t))

dec symm sigma
dec vect uvect

frml Lt = $
v11(t)=h11(t), v22(t)=h22(t), v33(t)=h33(t), $
v44(t)=h44(t), v12(t)=h12(t), v13(t)=h13(t), v14(t)=h14(t), $
v23(t)=h23(t), v24(t)=h24(t), v34(t)=h34(t), $
u1(t)=e1(t), u2(t)=e2(t), u3(t)=e3(t), u4(t)=e4(t), $
sigma= $
||v11(t)|v12(t),v22(t)|v13(t),v23(t),v33(t)|v14(t),v24(t),v34(t),v44(t)||, $
uvect=||u1(t),u2(t),u3(t),u4(t)||, $
%LOGDENSITY(sigma,uvect)

compute b10=0.004759, b11=-0.064022, b12=-0.059640, b13=0.007533, b14=-0.184149
compute a10=-0.065322, a11=0.062494, a12=0.1, a13=0.08, a14=0.06, g1=-0.017403, c1=0.989791
compute v11(start)=%seesq, u1(start)=.03

compute b20=-0.013284, b21=0.135120, b223=-0.072493, b23=0.015891, b24=-1.131651
compute a20=-0.067463, a21=0.03, a22=0.099502, a23=0.08, a24=0.06, g2=-0.073558, c2=0.972485
compute v22(start)=%seesq, u2(start)=.04

compute b30=-0.035990, b31=0.100196, b32=0.017968, b33=-0.003133, b34=2.584497
compute a30=-0.066142, a31=0.03, a32=0.1, a33=0.096110, a34=0.008, g3=-0.041080, c3=1.481290, c32=-0.495263
compute v33(start)=%seesq, u3(start)=.024

compute b40=-0.0000386, b41=0.000412, b42=0.003839, b43=0.005492, b44=-0.201574, $
b442=-0.088850, b443=-0.058470, b444=-0.078518, b445=-0.067282
compute a40=-0.368418, a41=0.07, a42=0.04, a43=0.016, a44=0.237456, g4=-0.025393, c4=0.665912, c42=-0.321226, c43=0.637099
compute v44(start)=%seesq, u4(start)=.034

compute r12=-0.3133, r13=-0.138062, r14=-0.081462, r23=0.727051, r24=-0.010275, r34=-0.014401

nlpar(subiterations=1000, CVCRIT=0.000001)
maximize(method=simplex,recursive,iter=2) Lt start+1 end
## SR10. Missing Values And/Or SMPL Options Leave No Usable Data Points
maximize(method=bhhh,recursive,iter=500) Lt start+1 end
Note that the initial values have already been given. These were estimated from E-views (along with some guessing).

Whenever I try to run "maximize" I get the error message. I have discovered that this problem is related to the number of lags in my model. The original code, with only AR(1)- and E-GARCH(1,1)-terms, works fine. After I include more AR-terms into the mean equation, or additional GARCH-terms into the variance equation the code stops working. As I said earlier I am not that familiar with RATS coding, but I figured that it must have someting to do with my choice of starting date, since I loose a number of observations when I include several lags into the model. I tried changing the starting date several days, months and even years forward but it did not work.

I would very much appreciate any help that you could give me.

Yours sincerely

Markus Broman
HANKEN School of Economics

Re: Multivariate E-GARCH models

Posted: Mon Jul 06, 2009 2:21 pm
by TomDoan
Markus86 wrote:I am trying to estimate a multivariate (4x4) EGARCH for a set of return series. I have previously done all my work in E-views (M.Sc.) and this is my first project in RATS. I am trying to modify a RATS code that I got during a course in Volatility modelling. Unfortunately, when I try to run the code I get the following error message:

<<most code snipped>>

Code: Select all

frml h44 =  $
exp(a40+a41*z1{1}+a42*z2{1}+a43*z3{1}+a44*z4{1}+c4*log(v44{1})+c42*log(v44{2})+c43*log(v44{3}))
maximize(method=simplex,recursive,iter=2) Lt start+1 end
Note that the initial values have already been given. These were estimated from E-views (along with some guessing).

Whenever I try to run "maximize" I get the error message. I have discovered that this problem is related to the number of lags in my model. The original code, with only AR(1)- and E-GARCH(1,1)-terms, works fine. After I include more AR-terms into the mean equation, or additional GARCH-terms into the variance equation the code stops working. As I said earlier I am not that familiar with RATS coding, but I figured that it must have someting to do with my choice of starting date, since I loose a number of observations when I include several lags into the model. I tried changing the starting date several days, months and even years forward but it did not work.

I would very much appreciate any help that you could give me.

Yours sincerely

Markus Broman
HANKEN School of Economics
With that formula requiring a 3rd lag of v44, you'll have to start estimation at start+3, not start+1.

Re: Multivariate E-GARCH models

Posted: Tue Jul 07, 2009 4:15 am
by Markus86
TomDoan wrote: With that formula requiring a 3rd lag of v44, you'll have to start estimation at start+3, not start+1.
As I said in my post I have tried to change the starting date, without any success. In one mean equation I have five lags:

Code: Select all

frml e4 = r4-b40-b41*r1{1}-b42*r2{1}-b43*r3{1}-b44*r4{1}-b442*r4{2}-b443*r4{3} $
-b444*r4{4}-b445*r4{5}
This is the maximum number of lags in this case, and I have tried with Lt start +5 and even higher starting dates without success. I get this problem as soon as I include more than one lag into any equation.

Re: Multivariate E-GARCH models

Posted: Tue Jul 07, 2009 6:38 am
by TomDoan
The problem is that you're initializing the variances (v11, etc.) to zero, but then are dividing through by them in computing the z formulas for the first data point. If you start with (for instance) the unconditional variances:

Code: Select all

vcv
# r1 to r4
set v11 = %sigma(1,1)
set v22 = %sigma(2,2)
set v33 = %sigma(3,3)
set v44 = %sigma(4,4)
it should work fine (as long as you allow for the other lags in the model).

Re: Multivariate E-GARCH models

Posted: Tue Jul 07, 2009 8:02 am
by Markus86
TomDoan wrote:The problem is that you're initializing the variances (v11, etc.) to zero, but then are dividing through by them in computing the z formulas for the first data point. If you start with (for instance) the unconditional variances:

Code: Select all

vcv
# r1 to r4
set v11 = %sigma(1,1)
set v22 = %sigma(2,2)
set v33 = %sigma(3,3)
set v44 = %sigma(4,4)
it should work fine (as long as you allow for the other lags in the model).
Now it's working! Thank you so much for your help!