Page 1 of 2

M-GARCH-M in GARCH Wizard

Posted: Sat Jul 30, 2011 6:37 pm
by PERRY
Hello,

How can I estimate a multivariate GARCH in the mean model within the GARCH Wizard?

Re: M-GARCH-M in GARCH Wizard

Posted: Sun Jul 31, 2011 7:47 pm
by PERRY
I tried to follow the manual and wrote this code but it does not work I get the message:

Image

Uploaded with ImageShack.us

Re: M-GARCH-M in GARCH Wizard

Posted: Tue Aug 02, 2011 9:29 am
by moderator
I don't think you can do that using the Wizard, at least currently. You need to define the equations, GROUP them into a MODEL, and supply that via the MODEL option. See page 301 of the RATS 8 User's Guide for details.

Regards,
Tom Maycock
Estima

Re: M-GARCH-M in GARCH Wizard

Posted: Tue Aug 02, 2011 11:26 am
by PERRY
Thank you Tom.

I was hopping to avoid that as I am new to RATS programming and I had already read page UG301 and I came up with the program

Code: Select all

CALENDAR(M) 1973:11
OPEN DATA "C:\Users\User\Desktop\110722 Energy RATS\dataus.txt"
DATA(FORMAT=PRN,NOLABELS,ORG=COLUMNS,TOP=2,RIGHT=3) 1973:11 2007:10 DATES OIL IPI


/* PRE-ESTIMATION */

dec symm[series] hhs(2,2)
clear(zeros) hhs
equation oileq oil
# constant hhs(1,1) hhs(1,2)
equation ipieq ipi
# constant hhs(2,1) hhs(2,2)

group garchm oileq ipieq
garch(model=garchm,p=1,q=1,pmethod=simplex,piters=10,$
mvhseries=hhs)


/* ESTIMATION OF THE M-GARCH-M */


GARCH(P=1,Q=1,MV=BEKK,REGRESSORS) / OIL IPI
# Constant OIL IPI HHS(1,1) HHS(2,1) HHS(2,2)

Re: M-GARCH-M in GARCH Wizard

Posted: Tue Aug 02, 2011 12:47 pm
by TomDoan
The first of the two looks correct. Generally, you only include the "own" covariances in the mean model. The second one clearly is incorrect, because you're including current OIL in the equations---perhaps you mean OIL{1} which would put the lagged value in.

Re: M-GARCH-M in GARCH Wizard

Posted: Tue Aug 02, 2011 12:55 pm
by PERRY
Running the above program I get the following output:

Code: Select all

MV-GARCH, BEKK - Estimation by BFGS
Convergence in   159 Iterations. Final criterion was  0.0000000 <=  0.0000100
Monthly Data From 1973:11 To 2007:10
Usable Observations                                                                                      408
Log Likelihood                                                                                     2090.6861

    Variable                                                                                       Coeff      Std Error      T-Stat      Signif
***************************************************************************************************************************************************
1.  Constant                                                                                    -4.0560e-003  7.6905e-004     -5.27400  0.00000013
2.  OIL                                                                                              -0.6627       0.0960     -6.90462  0.00000000
3.  IPI                                                                                               0.0000       0.0000      0.00000  0.00000000
4.  HHS(1,1)                                                                                          0.0000       0.0000      0.00000  0.00000000
5.  HHS(2,1)                                                                                          0.0000       0.0000      0.00000  0.00000000
6.  HHS(2,2)                                                                                          0.0000       0.0000      0.00000  0.00000000
7.  ¾OYÃ\݇?øzøÂÚf»>nŸ)ÝHL¿Ã„Ô¤ô²¼?Ðõá0¼>{Õ¾të±?8ÄhL®~¿àÊNŸŠ
U¾Ð¼—šµÔe¾d ÂgÇ|B¾ç‘Àtš—5¿~` -4.9031e+238       0.0000      0.00000  0.00000000
8.  Ðõá0¼>{Õ¾të±?8ÄhL®~¿àÊNŸŠ
U¾Ð¼—šµÔe¾d ÂgÇ|B¾ç‘Àtš—5¿~`                                     4203.2627       0.0000      0.00000  0.00000000
9.  ¼—šµÔe¾d ÂgÇ|B¾ç‘Àtš—5¿~`                                                                         0.0000       0.0000      0.00000  0.00000000
10. ó–qýì>ð`nŽ}k=?§"=N÷ªì?åv>ÔÖâ¾Š·øbn¼?]˜9,Þ­Ô?>y*è…¦¾o•¤að„¾ê"£|P‡>&}ð(Í?5¿ˆÍžjc          36793.2891       0.0000      0.00000  0.00000000
11. øbn¼?]˜9,Þ­Ô?>y*è…¦¾o•¤að„¾ê"£|P‡>&}ð(Í?5¿ˆÍžjc                                          1.1731e+021       0.0000      0.00000  0.00000000
12. P‡>&}ð(Í?5¿ˆÍžjc                                                                          -2.5677e+045       0.0000      0.00000  0.00000000
13. C(1,1)                                                                                      -7.2427e-003  1.7902e-003     -4.04579  0.00005215
14. C(2,1)                                                                                      -8.8975e-005  1.6438e-003     -0.05413  0.95683315
15. C(2,2)                                                                                       2.8661e-006  4.9067e-003 5.84128e-004  0.99953393
16. A(1,1)                                                                                           -0.8041       0.1463     -5.49438  0.00000004
17. A(1,2)                                                                                           -0.2136       0.1126     -1.89697  0.05783225
18. A(2,1)                                                                                            0.2031       0.2289      0.88734  0.37489799
19. A(2,2)                                                                                           -0.3593       0.1668     -2.15351  0.03127829
20. B(1,1)                                                                                            1.2237       0.2725      4.49011  0.00000712
21. B(1,2)                                                                                            1.1514       0.1842      6.25248  0.00000000
22. B(2,1)                                                                                           -0.6243       0.4439     -1.40662  0.15953878
23. B(2,2)                                                                                           -0.9113       0.2513     -3.62565  0.00028824

Re: M-GARCH-M in GARCH Wizard

Posted: Tue Aug 02, 2011 2:35 pm
by TomDoan
PERRY wrote:Running the above program I get the following output:

Code: Select all

MV-GARCH, BEKK - Estimation by BFGS
Convergence in   159 Iterations. Final criterion was  0.0000000 <=  0.0000100
Monthly Data From 1973:11 To 2007:10
Usable Observations                                                                                      408
Log Likelihood                                                                                     2090.6861

    Variable                                                                                       Coeff      Std Error      T-Stat      Signif
***************************************************************************************************************************************************
1.  Constant                                                                                    -4.0560e-003  7.6905e-004     -5.27400  0.00000013
2.  OIL                                                                                              -0.6627       0.0960     -6.90462  0.00000000
3.  IPI                                                                                               0.0000       0.0000      0.00000  0.00000000
4.  HHS(1,1)                                                                                          0.0000       0.0000      0.00000  0.00000000
5.  HHS(2,1)                                                                                          0.0000       0.0000      0.00000  0.00000000
6.  HHS(2,2)                                                                                          0.0000       0.0000      0.00000  0.00000000
7.  ¾OYÃ\݇?øzøÂÚf»>nŸ)ÝHL¿Ã„Ô¤ô²¼?Ðõá0¼>{Õ¾të±?8ÄhL®~¿àÊNŸŠ
U¾Ð¼—šµÔe¾d ÂgÇ|B¾ç‘Àtš—5¿~` -4.9031e+238       0.0000      0.00000  0.00000000
8.  Ðõá0¼>{Õ¾të±?8ÄhL®~¿àÊNŸŠ
U¾Ð¼—šµÔe¾d ÂgÇ|B¾ç‘Àtš—5¿~`                                     4203.2627       0.0000      0.00000  0.00000000
9.  ¼—šµÔe¾d ÂgÇ|B¾ç‘Àtš—5¿~`                                                                         0.0000       0.0000      0.00000  0.00000000
10. ó–qýì>ð`nŽ}k=?§"=N÷ªì?åv>ÔÖâ¾Š·øbn¼?]˜9,Þ­Ô?>y*è…¦¾o•¤að„¾ê"£|P‡>&}ð(Í?5¿ˆÍžjc          36793.2891       0.0000      0.00000  0.00000000
11. øbn¼?]˜9,Þ­Ô?>y*è…¦¾o•¤að„¾ê"£|P‡>&}ð(Í?5¿ˆÍžjc                                          1.1731e+021       0.0000      0.00000  0.00000000
12. P‡>&}ð(Í?5¿ˆÍžjc                                                                          -2.5677e+045       0.0000      0.00000  0.00000000
13. C(1,1)                                                                                      -7.2427e-003  1.7902e-003     -4.04579  0.00005215
14. C(2,1)                                                                                      -8.8975e-005  1.6438e-003     -0.05413  0.95683315
15. C(2,2)                                                                                       2.8661e-006  4.9067e-003 5.84128e-004  0.99953393
16. A(1,1)                                                                                           -0.8041       0.1463     -5.49438  0.00000004
17. A(1,2)                                                                                           -0.2136       0.1126     -1.89697  0.05783225
18. A(2,1)                                                                                            0.2031       0.2289      0.88734  0.37489799
19. A(2,2)                                                                                           -0.3593       0.1668     -2.15351  0.03127829
20. B(1,1)                                                                                            1.2237       0.2725      4.49011  0.00000712
21. B(1,2)                                                                                            1.1514       0.1842      6.25248  0.00000000
22. B(2,1)                                                                                           -0.6243       0.4439     -1.40662  0.15953878
23. B(2,2)                                                                                           -0.9113       0.2513     -3.62565  0.00028824
That's out of the second GARCH instruction, which isn't properly formed. The REGRESSORS option was never really designed to work on a multivariate model; instead, you need to use the MODEL option, as is done in your first GARCH.

Re: M-GARCH-M in GARCH Wizard

Posted: Wed Aug 03, 2011 1:46 pm
by PERRY
TomDoan wrote:The first of the two looks correct. Generally, you

only include the "own" covariances in the mean model. The second one

clearly is incorrect, because you're including current OIL in the

equations---perhaps you mean OIL{1} which would put the lagged value

in.
Tom thank you again for all the help, I really appreciate it.

The program I posted is my impression from page UG301 of how I should

structure a M-GARCH-M. I thought both the first two as you mention and

the last part are needed to estimate the M-GARCH-M for the multivariate

system OIL, IPI.

Regarding the inclusion of the contemporaneous OIL and IPI I did not

notice it was not lagged.

Re: M-GARCH-M in GARCH Wizard

Posted: Wed Aug 03, 2011 2:01 pm
by PERRY
Here is how I modified the code based on the above:

Code: Select all

CALENDAR(M) 1973:11
OPEN DATA "C:\Users\User\Desktop\110722 Energy RATS\dataus.txt"
DATA(FORMAT=PRN,NOLABELS,ORG=COLUMNS,TOP=2,RIGHT=3) 1973:11 2007:10 

DATES OIL IPI
I assume that with the following I manage to create a matrix that will store the initial values and then the actual values for the conditional variances and covariances.

Code: Select all

dec symm[series] hhs(2,2)
clear(zeros) hhs
Below I define the two equations that I need for the M-GARCH-M I want to estimate.
I still do not understand how RATS will associate hhs(i,j) with the conditional variances/covariances. It looks like the mean equation of a multivariate GARCH in-the-mean model without any other than the constant and the conditional variances explanatory variables but still hhs(i,j) are not associated with anything...

Code: Select all

equation oileq oil
# constant hhs(1,1) hhs(1,2) hhs(2,1) hhs(2,2)
equation ipieq ipi
# constant hhs(1,1) hhs(1,2) hhs(2,1) hhs(2,2)
Next we group the equations into a model labeled "garchm" as you advised:

Code: Select all

group garchm oileq ipieq
Finally in the last part of the program we instruct RATS to perform a GARCH(1,1) estimation using the "garchm" model, BEKK specification, preliminary estimation using simplex with 10 iterations.

Code: Select all

garch(model=garchm,p=1,q=1,mv=BEKK,pmethod=simplex,piters=10,$
mvhseries=hhs)
Is the following the part where RATS stores the conditional variances/covariances in the hss matrix?

Code: Select all

mvhseries=hhs
That is it? sorry for being so analytical but I am trying to understand the logic. I have been told RATS is very powerful and want to be able to use it for more than standard programs.

Thank you in advance Tom...!!!

Re: M-GARCH-M in GARCH Wizard

Posted: Wed Aug 03, 2011 2:21 pm
by moderator
PERRY wrote: Is the following the part where RATS stores the conditional variances/covariances in the hss matrix?

Code: Select all

mvhseries=hhs
Yes. The key is to refer to the same variable name on both the MVHSERIES option and in your equations.

Regards,
Tom Maycock
Estima

Re: M-GARCH-M in GARCH Wizard

Posted: Fri Aug 05, 2011 8:26 am
by PERRY
OK now I run the program:

Code: Select all

CALENDAR(M) 1973:11
OPEN DATA "C:\Users\User\Desktop\110722 Energy RATS\dataus.txt"
DATA(FORMAT=PRN,NOLABELS,ORG=COLUMNS,TOP=2,RIGHT=3) 1973:11 2007:10 DATES OIL IPI

/* PRE-ESTIMATION */

dec symm[series] hhs(2,2)
clear(zeros) hhs
equation oileq oil
# constant hhs(1,1) hhs(1,2) hhs(2,1) hhs(2,2)
equation ipieq ipi
# constant hhs(1,1) hhs(1,2) hhs(2,1) hhs(2,2)

group garchm oileq ipieq
garch(model=garchm,p=1,q=1,mv=BEKK,pmethod=simplex,piters=10,$
mvhseries=hhs)
And I got these results:

Code: Select all


MV-GARCH, BEKK - Estimation by BFGS
Convergence in    49 Iterations. Final criterion was  0.0000045 <=  0.0000100
Monthly Data From 1973:11 To 2007:10
Usable Observations                       408
Log Likelihood                      2106.4402

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  Constant                        0.0030665    0.0063040      0.48644  0.62665755
2.  HHS(1,1)                        2.7241851    1.2881911      2.11474  0.03445239
3.  HHS(2,1)                      -58.0674533   21.4759674     -2.70383  0.00685445
4.  HHS(2,1)                      -57.7541027   21.4759760     -2.68924  0.00716144
5.  HHS(2,2)                     -160.8529558   95.2018502     -1.68960  0.09110469
6.  Constant                        0.0043623    0.0013002      3.35503  0.00079358
7.  HHS(1,1)                       -0.0427378    0.0812831     -0.52579  0.59903456
8.  HHS(2,1)                       -1.9714207    1.7100354     -1.15285  0.24897043
9.  HHS(2,1)                       -1.9022851    1.7100860     -1.11239  0.26596986
10. HHS(2,2)                      -20.9218211   20.8896361     -1.00154  0.31656546
11. C(1,1)                          0.0079456    0.0014138      5.61989  0.00000002
12. C(2,1)                          0.0000917    0.0012644      0.07249  0.94221068
13. C(2,2)                          0.0028532    0.0013020      2.19145  0.02841922
14. A(1,1)                          0.6897016    0.0710530      9.70686  0.00000000
15. A(1,2)                          0.0157191    0.0068716      2.28756  0.02216303
16. A(2,1)                         -0.0791518    0.3584136     -0.22084  0.82521761
17. A(2,2)                          0.4041140    0.1105482      3.65555  0.00025663
18. B(1,1)                          0.8050431    0.0306167     26.29421  0.00000000
19. B(1,2)                         -0.0058133    0.0051301     -1.13319  0.25713322
20. B(2,1)                         -0.1306640    0.3039599     -0.42987  0.66728833
21. B(2,2)                          0.7970205    0.1404967      5.67288  0.00000001
My main interest in doing this is to see how the conditional variance of OIL affects the mean equation of the IPI.

To make sure I am reading the output correctly, coefficients 1-5 are for the mean equation of OIL and 6-10 for the mean equation for IPI.
Also, 5-21 are for the conditional variances covariances.

They way it is constructed, what is the coefficient I am looking for? It must be coefficient #7 as OIL is the first variable and equation defined and IPI is the second so that
coefficient #7 gives the effect of the conditional variance of OIL in the IPI mean equation.

Am I right?

Thank you so much!

Re: M-GARCH-M in GARCH Wizard

Posted: Mon Aug 08, 2011 2:08 pm
by TomDoan
Because of symmetry H(2,1) and H(1,2) are the same, so you should leave one out of the regressor list. As you have this set up, yes, the effect of the variance of oil on the mean of IP is coefficient 7.

Re: M-GARCH-M in GARCH Wizard

Posted: Mon Mar 09, 2015 2:58 am
by thaotc4ueh
TomDoan wrote:Because of symmetry H(2,1) and H(1,2) are the same, so you should leave one out of the regressor list. As you have this set up, yes, the effect of the variance of oil on the mean of IP is coefficient 7.
Dear TomDoan
If I use above code, but in my equation there is a asymmetric term,and use quasi-maximum likelihood, what must I add in that code
And how to compute Likelihood ratio to compare univariate garch-m with bivariate garch-m, what can I do
I look forward to here from you
Thao

Re: M-GARCH-M in GARCH Wizard

Posted: Mon Mar 09, 2015 9:55 am
by TomDoan
Just add the ASYMMETRIC option to the GARCH instruction. For QMLE, just add the ROBUSTERRORS option (that's described in the v9 User's Guide in Section 9.3.7).

The test for univariate vs multivariate is very uninteresting. The likelihood for the univariate models doesn't allow for any contemporaneous correlation. Since that is usually rather high (.7 or more), the test will reject overwhelmingly on that basis alone---likelihood ratio statistics on the order of 1000's are fairly common.

Re: M-GARCH-M in GARCH Wizard

Posted: Mon Mar 09, 2015 11:07 am
by thaotc4ueh
TomDoan wrote:Just add the ASYMMETRIC option to the GARCH instruction. For QMLE, just add the ROBUSTERRORS option (that's described in the v9 User's Guide in Section 9.3.7).

The test for univariate vs multivariate is very uninteresting. The likelihood for the univariate models doesn't allow for any contemporaneous correlation. Since that is usually rather high (.7 or more), the test will reject overwhelmingly on that basis alone---likelihood ratio statistics on the order of 1000's are fairly common.
thank you for your reply
one more question, how can I test 2 equality between 2 coefficient and test(zero) together, different example: H0: h11=h12=0, a11=a12
and how can I export file conditional variance and covariance, conditional correllation,
this is my code:
OPEN DATA "E:\KL\Book1.txt"
CALENDAR(M) 2005:2
DATA(FORMAT=PRN,ORG=COLUMNS) 2005:02 2014:12 MKT IA ROE SMB HML DY RREL
/* PRE-ESTIMATION */

dec symm[series] hhs(2,2)
clear(zeros) hhs
equation mkteq mkt
# constant dy hhs(1,1) hhs(1,2) hhs(2,1) hhs(2,2)
equation iaeq ia
# constant dy hhs(1,1) hhs(1,2) hhs(2,1) hhs(2,2)

group garchm mkteq iaeq
garch(model=garchm,p=1,q=1,asymmetric,ROBUSTERRORS,mv=BEKK,pmethod=simplex,piters=10,$
hmatrices=bekkhh, MVHSERIES=bekkHmatrix, rvectors=bekkrv)
thank alots, I use rats 9 trial.