Page 1 of 1

Coefficient in the variance equation of the GARCH model

Posted: Sun Oct 29, 2017 6:33 am
by a.do88
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.

Re: Coefficient in the variance equation of the GARCH model

Posted: Sun Oct 29, 2017 4:21 pm
by EViews Gareth
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.

Re: Coefficient in the variance equation of the GARCH model

Posted: Tue Oct 31, 2017 7:14 am
by a.do88
[/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)?

Re: Coefficient in the variance equation of the GARCH model

Posted: Tue Oct 31, 2017 7:29 am
by EViews Gareth

Re: Coefficient in the variance equation of the GARCH model

Posted: Tue Oct 31, 2017 7:43 am
by a.do88
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?

Re: Coefficient in the variance equation of the GARCH model

Posted: Tue Oct 31, 2017 8:06 am
by a.do88
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.

Re: Coefficient in the variance equation of the GARCH model

Posted: Tue Oct 31, 2017 8:10 am
by startz
%i versus !i ?

Re: Coefficient in the variance equation of the GARCH model

Posted: Tue Oct 31, 2017 9:06 am
by EViews Gareth
And a space after colplace.

Re: Coefficient in the variance equation of the GARCH model

Posted: Tue Oct 31, 2017 6:55 pm
by a.do88
%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?

Re: Coefficient in the variance equation of the GARCH model

Posted: Tue Oct 31, 2017 7:33 pm
by EViews Gareth
You’ll need a numerical variable to keep track of which column you are on

Re: Coefficient in the variance equation of the GARCH model

Posted: Wed Nov 01, 2017 7:26 am
by a.do88
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

Re: Coefficient in the variance equation of the GARCH model

Posted: Wed Nov 01, 2017 7:49 am
by EViews Gareth

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

Re: Coefficient in the variance equation of the GARCH model

Posted: Wed Nov 01, 2017 9:06 am
by a.do88
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.

Re: Coefficient in the variance equation of the GARCH model

Posted: Wed Nov 01, 2017 9:31 am
by a.do88

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.