Coefficient in the variance equation of the GARCH model

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator

a.do88
Posts: 27
Joined: Sat May 27, 2017 10:01 pm

Coefficient in the variance equation of the GARCH model

Postby a.do88 » Sun Oct 29, 2017 6:33 am

Hi,

I am running a GARCH model that has two equations (mean and variance equations). I can use the Eqtabs Adds-in to report the coefficients of the mean equation from multiple equations (e.g. country A& B, country B&C) in one table, however, this Adds-in does not report the coefficients in the variance equation.

So I run this one to extract all the coefficients of two equations (mean & variance) out and try to put that in the matrix using this command:

matrix m2 = eq_{%i}_{%j}.@coefs

**with eq_{%i}_{%j} is my equation name such as eq_au_au or eq_au_uk

and I got the message ===> Syntax error in "MATRIX M2 EQ_RUK_RAU.@COEFS".

I also tried another way using these commands:
matrix (7,4) m2
colplace (m2, eq_{%i}_{%j}.@coefs,....)

My problem is I not sure which integer to put it. So in this exercise, I got 4 equations saved in this order
eq_rau_rau -----> call this one equation 1
eq_rau_ruk ----------> equation 2
eq_ruk_rau -------------> equation 3
eq_ruk_ruk -----------------> equation 4
so I just need the coeffcients of the equation 1 to stay in the column 1 and so on.
So how do I input the integer?

Any help is greatly appreciated.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11506
Joined: Tue Sep 16, 2008 5:38 pm

Re: Coefficient in the variance equation of the GARCH model

Postby EViews Gareth » Sun Oct 29, 2017 4:21 pm

a.do88 wrote:matrix m2 = eq_{%i}_{%j}.@coefs

**with eq_{%i}_{%j} is my equation name such as eq_au_au or eq_au_uk

and I got the message ===> Syntax error in "MATRIX M2 EQ_RUK_RAU.@COEFS".


That error message would indicate you forgot the = sign.
Follow us on Twitter @IHSEViews

a.do88
Posts: 27
Joined: Sat May 27, 2017 10:01 pm

Re: Coefficient in the variance equation of the GARCH model

Postby a.do88 » Tue Oct 31, 2017 7:14 am

[/quote]

That error message would indicate you forgot the = sign.[/quote]
Thanks Gareth. I now have 4 different matrix:
m_rau_rau
m_rau_ruk
m_ruk_rau
m_ruk_ruk

which each matrix has one column and 7 rows. Is there any way to combine them into 1 matrix ( 4 columns and 7 rows)?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11506
Joined: Tue Sep 16, 2008 5:38 pm

Re: Coefficient in the variance equation of the GARCH model

Postby EViews Gareth » Tue Oct 31, 2017 7:29 am

Follow us on Twitter @IHSEViews

a.do88
Posts: 27
Joined: Sat May 27, 2017 10:01 pm

Re: Coefficient in the variance equation of the GARCH model

Postby a.do88 » Tue Oct 31, 2017 7:43 am

EViews Gareth wrote:http://www.eviews.com/help/helpintro.html#page/content/matrixref-@hcat.html


Thanks Gareth. But my actual thesis has 289 matrix objects that I need to combine into one matrix, is @hcat only for combining 2 matrix objects?

a.do88
Posts: 27
Joined: Sat May 27, 2017 10:01 pm

Re: Coefficient in the variance equation of the GARCH model

Postby a.do88 » Tue Oct 31, 2017 8:06 am

EViews Gareth wrote:http://www.eviews.com/help/helpintro.html#page/content/matrixref-@hcat.html


I tried to use colplace with this command:

for %i rau ruk
for %j ruk rau
equation eq_{%i}_{%j}.arch(1,1, egarch, ged) {%i} c {%j}(-1)
colplace (result02, eq_{%i}_{%j}.@coefs, !i)
next
next

And I got this message: -----> !i is not defined in "COLPLACE (RESULT02, EQ_RAU_RUK.@COEFS, !i)".

Can you please help.

startz
Non-normality and collinearity are NOT problems!
Posts: 3194
Joined: Wed Sep 17, 2008 2:25 pm

Re: Coefficient in the variance equation of the GARCH model

Postby startz » Tue Oct 31, 2017 8:10 am

%i versus !i ?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11506
Joined: Tue Sep 16, 2008 5:38 pm

Re: Coefficient in the variance equation of the GARCH model

Postby EViews Gareth » Tue Oct 31, 2017 9:06 am

And a space after colplace.
Follow us on Twitter @IHSEViews

a.do88
Posts: 27
Joined: Sat May 27, 2017 10:01 pm

Re: Coefficient in the variance equation of the GARCH model

Postby a.do88 » Tue Oct 31, 2017 6:55 pm

startz wrote:%i versus !i ?


I used %i but it said Non numeric argument in "COLPLACE (RESULT02,
EQ_RAU_RUK.@COEFS,"RAU")".

which I think it read "RAU" as a text. Is there any way to fix it?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11506
Joined: Tue Sep 16, 2008 5:38 pm

Re: Coefficient in the variance equation of the GARCH model

Postby EViews Gareth » Tue Oct 31, 2017 7:33 pm

You’ll need a numerical variable to keep track of which column you are on
Follow us on Twitter @IHSEViews

a.do88
Posts: 27
Joined: Sat May 27, 2017 10:01 pm

Re: Coefficient in the variance equation of the GARCH model

Postby a.do88 » Wed Nov 01, 2017 7:26 am

EViews Gareth wrote:You’ll need a numerical variable to keep track of which column you are on


Hi Gareth,

I tried with this command, it fills up the whole matrix table, however, it uses the value of the last equation to fill up all whole table, any suggestion on how to fix it is greatly appreciated.

for %i rau rger
for %j ruk rus
for !j =1 to 2
colplace (result_{%i}, eq_{%i}_{%j}.@coefs,!j)
next
next
next

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11506
Joined: Tue Sep 16, 2008 5:38 pm

Re: Coefficient in the variance equation of the GARCH model

Postby EViews Gareth » Wed Nov 01, 2017 7:49 am

Code: Select all

!col = 1
for %i rau rger
for %j ruk rus
colplace (result_{%i}, eq_{%i}_{%j}.@coefs,!col)
!col=!col+1
next
next
Follow us on Twitter @IHSEViews

a.do88
Posts: 27
Joined: Sat May 27, 2017 10:01 pm

Re: Coefficient in the variance equation of the GARCH model

Postby a.do88 » Wed Nov 01, 2017 9:06 am

Thanks Gareth. I tried this command to store the same coefficients of all equations into one table and it works

!rowcounter=1
for %i rau
for %j rau rger rhk rhs rin rjp rma rnz rphi rsha rshb rsing rsza rszb rthai ruk rus
freeze(table) eq_{%i}_{%j}
result_constant_{%i}(!rowcounter,1) = @val(table(15,2))
result_constant_{%i}(!rowcounter,2)=@val(table(15,5))
result_return_spillover_{%i}(!rowcounter,1) = @val(table(16,2))
result_return_spillover_{%i}(!rowcounter,2)=@val(table(16,5))
result_c3_{%i}(!rowcounter,1) = @val(table(20,2))
result_c3_{%i}(!rowcounter,2)=@val(table(20,5))
result_c4_{%i}(!rowcounter,1) = @val(table(21,2))
result_c4_{%i}(!rowcounter,2)=@val(table(21,5))
result_c5_{%i}(!rowcounter,1) = @val(table(22,2))
result_c5_{%i}(!rowcounter,2)=@val(table(22,5))
result_c6_{%i}(!rowcounter,1) = @val(table(23,2))
result_c6_{%i}(!rowcounter,2)=@val(table(23,5))
!rowcounter=!rowcounter+1
d table
next
next

However, if I add another variable into the %i, for example, RGER - I got the message "(18,1) is not a valid index for matrix RESULT_CONSTANT_RGER in "RESULT_CONSTANT_{%I}(18,1) = @VAL(TABLE(15,2))". Does it mean even though it uses the new matrix table when %i changes, it starts at the 18th row in the new matrix RESULT_CONSTANT_RGER (my matrix only got 17 rows)?

Any suggestions to use loop to repeat the whole command for the new variable %i is greatly appreciated.

a.do88
Posts: 27
Joined: Sat May 27, 2017 10:01 pm

Re: Coefficient in the variance equation of the GARCH model

Postby a.do88 » Wed Nov 01, 2017 9:31 am

EViews Gareth wrote:

Code: Select all

!col = 1
for %i rau rger
for %j ruk rus
colplace (result_{%i}, eq_{%i}_{%j}.@coefs,!col)
!col=!col+1
next
next


Also, when I used this command, it stores the cofficients of RGER (i) with other variables RUK and RUS (j) in column 3th and 4th of the matrix of RGER.

So even though, it uses the correct matrix table for each variable %i, the column continues from the equations of RAU so it stores the cofficients of the
RAU-RUK : 1st column (of the matrix table RAU)
RAU-RUS: 2nd column (of the matrix table RAU)
RGER-RUK: 3rd column (of the matrix table RGER)
and so on....

Is there any way to make it starts with the first column again when using a new matrix table.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 12 guests