VARMA GARCH Model

Discussions of ARCH, GARCH, and related models
hung
Posts: 6
Joined: Tue Aug 05, 2014 11:01 pm

Re: VARMA GARCH Model

Unread post by hung »

Dear Dr Thomas
Thank you very much. The following program is fine for other data (more than 3000 observations) but it report ##MAT15 as shown in the output below. Could you please advise the reason and solution? Is is problem come from 1325 observations for this program?

Thank you

Hung.

Code: Select all

* VARMA-MGARCH-asymmetry BEKK model.

OPEN DATA "C:\oilgas.xlsx"
CALENDAR(D) 2000:1:4
Allocate 2014:1:31
DATA(FORMAT=XLSX,ORG=COLUMNS) 2000:1:4 2014:1:31 rogindo rogmalay rogphil rogsing rogthai rogviet rogus rogasia
dec vect[series] sqrth(2)
dec vect[series] eps(2)


* VARMA (1,2)
system(model=varmah)
variables rogviet rogus
lags 1
det constant eps(1){1} eps(2){1} eps(1){2} eps(2){2}sqrth(1) sqrth(2)
end(system)
*


clear(zeros) sqrth eps
*
* Do three iterations on the VARMA part to get an initial value for the
* covariance matrix.
*
do iters=1,3
   estimate(noprint,resids=resids)
   set eps(1) %regstart() * = resids(1)
   set eps(2) %regstart() * = resids(2)
end do iters
*

compute cv0=%sigma

*
garch(model=varmah,mv=bekk, variances=spillover, asymmetric,$
rvectors=rv,hmatrices=hh,presample=cv0,$
uadjust=%pt(eps,t,rv(t)),hadjust=%pt(sqrth,t,%sqrt(%xdiag(hh(t)))),$
  pmethod=simplex,piters=20)

set z1 = rv(t)(1)/sqrt(hh(t)(1,1))
set z2 = rv(t)(2)/sqrt(hh(t)(2,2))
set z1sq = z1**2
set z2sq = z2**2
@bdindtests z1
@bdindtests z2
dec vect[series] zu(%nvar)
do time=%regstart(),%regend()
compute %pt(zu,time,%solve(%decomp(hh(time)),rv(time)))
end do time


*Ljung-Box Q-statistics of joint standardized residuals
@mvqstat(lag=5)
# zu
*Ljung-Box Q-statistics of joint standardized residual
@mvqstat(lags=10)
# zu

*Ljung-Box Q-statistics of square of joint standardized residuals
@mvarchtest (lags=5)
#zu
*Ljung-Box Q-statistics of square of joint standardized residuals
@mvarchtest (lags=10)
#zu

@regcorrs(report,number=10) z1
@regcorrs(report,number=10) z1sq

@regcorrs(report,number=10) z2
@regcorrs(report,number=10) z2sq
The output from the above program:

Code: Select all

MV-GARCH, BEKK - Estimation by BFGS
Convergence in   186 Iterations. Final criterion was  0.0000000 <=  0.0000100
Daily(5) Data From 2009:01:05 To 2014:01:31
Usable Observations                      1325
Log Likelihood                     -4859.3586

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  ROGVIET{1}                   -2.738396734  1.209987132     -2.26316  0.02362571
2.  ROGUS{1}                     -2.853725728  0.981046127     -2.90886  0.00362749
3.  Constant                      1.154269013  0.507851850      2.27285  0.02303547
4.  EPS(1){1}                     2.788587596  1.212052832      2.30071  0.02140777
5.  EPS(2){1}                     3.058551651  0.975575983      3.13512  0.00171781
6.  EPS(1){2}                     0.126313112  0.112760344      1.12019  0.26263242
7.  EPS(2){2}                     0.587871904  0.300989229      1.95313  0.05080387
8.  SQRTH(1)                     -0.014794419  0.153268254     -0.09653  0.92310258
9.  SQRTH(2)                     -0.675674909  0.313069010     -2.15823  0.03090996
10. ROGVIET{1}                    2.865050231  1.347163702      2.12673  0.03344272
11. ROGUS{1}                      2.897280167  1.108791147      2.61301  0.00897492
12. Constant                     -0.826555134  0.462079904     -1.78877  0.07365170
13. EPS(1){1}                    -2.864615392  1.346329210     -2.12772  0.03336007
14. EPS(2){1}                    -2.873769480  1.102642238     -2.60626  0.00915376
15. EPS(1){2}                    -0.138278161  0.117261187     -1.17923  0.23830575
16. EPS(2){2}                    -0.633469586  0.326450995     -1.94047  0.05232214
17. SQRTH(1)                     -0.015669925  0.118387563     -0.13236  0.89469857
18. SQRTH(2)                      0.522904535  0.262990349      1.98830  0.04677817
19. C(1,1)                        0.656860634  0.090670926      7.24445  0.00000000
20. C(2,1)                       -0.051489018  0.051416212     -1.00142  0.31662572
21. C(2,2)                        0.154841648  0.030491157      5.07825  0.00000038
22. A(1,1)                        0.393865616  0.038810071     10.14854  0.00000000
23. A(1,2)                        0.019908753  0.022344926      0.89097  0.37294300
24. A(2,1)                       -0.040764790  0.043373191     -0.93986  0.34728864
25. A(2,2)                        0.092651099  0.041889948      2.21177  0.02698228
26. B(1,1)                        0.853747395  0.031396878     27.19211  0.00000000
27. B(1,2)                        0.001017815  0.016230305      0.06271  0.94999680
28. B(2,1)                        0.024290642  0.015043845      1.61466  0.10638510
29. B(2,2)                        0.951992102  0.008101793    117.50387  0.00000000
30. D(1,1)                       -0.028890267  0.113369388     -0.25483  0.79885205
31. D(1,2)                        0.026287471  0.029676964      0.88579  0.37573228
32. D(2,1)                       -0.017947745  0.054973976     -0.32648  0.74406340
33. D(2,2)                        0.356511012  0.033911363     10.51303  0.00000000

## MAT15. Subscripts Too Large or Non-Positive
Error was evaluating entry 1
Attachments
oilgas.xlsx
(415.37 KiB) Downloaded 779 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: VARMA GARCH Model

Unread post by TomDoan »

Did you do "Edit-Show Last Error" to see where the error occurs? Offhand, it looks like your @MVARCHTEST lines are formatted wrong.
hung
Posts: 6
Joined: Tue Aug 05, 2014 11:01 pm

Re: VARMA GARCH Model

Unread post by hung »

TomDoan wrote:Did you do "Edit-Show Last Error" to see where the error occurs? Offhand, it looks like your @MVARCHTEST lines are formatted wrong.
Dear Dr Thomas Doan
Thank you very much. That problem comes from the empty cell in excel. I used the same sample for this short series. About @MVARCHTEST, I got it from your comment above. Could you please tell why it is wrong?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: VARMA GARCH Model

Unread post by TomDoan »

You have a space between the instruction and the option field.
abi
Posts: 74
Joined: Sat Apr 13, 2013 3:48 am

Re: VARMA GARCH Model

Unread post by abi »

Dera Tom,
could you guide me how can i do normality test for residuals? i think first of all the distribution of residuals should be specified and then another tests done.
Best Regard,
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: VARMA GARCH Model

Unread post by TomDoan »

Use the @MVJB procedure.
istiak
Posts: 29
Joined: Sun Nov 11, 2012 9:03 pm

Re: VARMA GARCH Model-convergence issues

Unread post by istiak »

Hi Tom,
I am using the attached code and dataset to run a MV-GARCH, BEKK model. The model does not converge, but the result shows that last criterion for convergence was 0.0000000. As this value is zero, are the coefficients reliable to use (even the model does NOT converge)? If they are not reliable, what I can do? I changed "iters" and "piters" values in the program, but the same problem persists. Please help me.
KI
Attachments
2014short.xlsx
(19.14 KiB) Downloaded 834 times
Test.RPF
(985 Bytes) Downloaded 1092 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: VARMA GARCH Model

Unread post by TomDoan »

It looks like it's fine. If you re-execute the instruction, it doesn't move. Note that that's a rather complicated model for just 126 observations. Also, do you expect that the one model is going to be able to handle the rather obvious structural change in your "C" variable in the last few years of the data set?
istiak
Posts: 29
Joined: Sun Nov 11, 2012 9:03 pm

Re: VARMA GARCH Model

Unread post by istiak »

Hi Tom,
You mentioned, "that's a rather complicated model for just 126 observations". I agree but what other alternative models I can use that consider the interaction and spillover effects among the three variables?

You mentioned, "do you expect that the one model is going to be able to handle the rather obvious structural change in your "C" variable in the last few years of the data set?". The answer is no. There are some other factors (say "F") besides "B" and "S" that is responsible for it. But "F" might not affect "B" and "S". Do you have any suggestion for me to model my dataset?

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

Re: VARMA GARCH Model

Unread post by TomDoan »

None of your series has all that strong a GARCH effect, so trying to estimate "M" effects doesn't really work well---in fact, because of the data don't seem to be governed by a single process, what you're getting is the "M" terms effectively dummying out observations. You really need to figure out the basic mean model first before worrying about anything else. Perhaps you need exogenous shifts, or you need to cut the sample off before the structural change. At any rate, you can't mechanically apply a model designed for a completely different set of variables in a different country and expect it to work.
jananikolic
Posts: 2
Joined: Wed Jun 05, 2019 5:41 pm

Re: VARMA GARCH Model

Unread post by jananikolic »

Hi,
I have one question. I want to code VAR(2)-BEKK-in mean (with standard deviation of unconditional variances in VAR equation)
I wrote the Code:

* VAR (2)
system(model=varmah)
variables pi y
lags 1 2
det constant sqrth(1) sqrth(2)
end(system)

clear(zeros) sqrth eps
*
* Do three iterations on the VARMA part to get an initial value for the
* covariance matrix.
*
do iters=1,3
estimate(noprint,resids=resids)
set eps(1) %regstart() * = resids(1)
set eps(2) %regstart() * = resids(2)
end do iters
*

compute cv0=%sigma

*
garch(model=varmah,mv=bekk,$
rvectors=rv,hmatrices=hh,presample=cv0,$
uadjust=%pt(eps,t,rv(t)),hadjust=%pt(sqrth,t,%sqrt(%xdiag(hh(t)))),$
pmethod=BHHH,piters=20)
*
And got output:

MV-GARCH, BEKK - Estimation by BFGS
Convergence in 191 Iterations. Final criterion was 0.0000010 <= 0.0000100

Monthly Data From 2007:04 To 2018:09
Usable Observations 138
Log Likelihood -454.1405

Variable Coeff Std Error T-Stat Signif
************************************************************************************
Mean Model(PI)
1. PI{1} 0.43298664 0.08678532 4.98917 0.00000061
2. PI{2} 0.27051240 0.10168380 2.66033 0.00780643
3. Y{1} -0.01972048 0.01331809 -1.48073 0.13867873
4. Y{2} 0.01465452 0.01152199 1.27187 0.20341789
5. Constant -1.01890723 1.63158305 -0.62449 0.53230586
6. SQRTH(1) -1.68447156 0.79004590 -2.13212 0.03299710
7. SQRTH(2) 0.65407615 0.51850840 1.26146 0.20714417
Mean Model(Y)
8. PI{1} 1.11620607 0.54992157 2.02976 0.04238145
9. PI{2} 0.35973132 0.52320697 0.68755 0.49173576
10. Y{1} -0.43235193 0.08150882 -5.30436 0.00000011
11. Y{2} -0.07632175 0.08138406 -0.93780 0.34834863
12. Constant -0.12734095 4.82266649 -0.02640 0.97893456
13. SQRTH(1) -9.58338738 3.91979783 -2.44487 0.01449053
14. SQRTH(2) 1.50252633 1.79235747 0.83830 0.40186441

15. C(1,1) 0.07024422 0.19225480 0.36537 0.71483493
16. C(2,1) -2.38598489 0.35745179 -6.67498 0.00000000
17. C(2,2) -0.00000039 17.18303781 -2.25281e-08 0.99999998
18. A(1,1) 0.48076781 0.10520202 4.56995 0.00000488
19. A(1,2) 0.64346607 0.46939804 1.37083 0.17042719
20. A(2,1) 0.03711517 0.01677891 2.21201 0.02696576
21. A(2,2) -0.11182759 0.07554353 -1.48031 0.13879143
22. B(1,1) 0.73436797 0.16597487 4.42457 0.00000966
23. B(1,2) -2.41709651 1.02368955 -2.36116 0.01821779
24. B(2,1) 0.10685893 0.01607863 6.64602 0.00000000
25. B(2,2) 0.36122144 0.18841405 1.91717 0.05521656


Is this corrext code?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: VARMA GARCH Model

Unread post by TomDoan »

That's the correct code for that model. Whether it's the correct model for the data is a different question. Did you pick a VAR(2) based upon this data set, or based upon what someone else did for different data? When you have serially correlated data, the mean model required to produce serially uncorrelated residuals will change from data set to data set. Note also that your second series appears to have only weak GARCH effects.
jananikolic
Posts: 2
Joined: Wed Jun 05, 2019 5:41 pm

Re: VARMA GARCH Model

Unread post by jananikolic »

    Thank you very much, Tom! I needed to be sure that the code is right first.
    I am doing model like https://www.sciencedirect.com/science/a ... 0608001423 in 5.3.- VAR GARCH-M model. What is the best way to choose the optimal leg length? As I can see from my data, optimal leg length is 1 (if I look at AIC and BIC criterium. What other tests should I use to check if the model is right? I have never used RATS before so I am not so good at it.
    I wanted to do an asymmetric model first, but I believe I don't have enough data. I am sending you my data in the attachment.
    Attachments
    exrates(daily)1.xls
    (128 KiB) Downloaded 647 times
    master.RPF
    (3.52 KiB) Downloaded 731 times
    TomDoan
    Posts: 7814
    Joined: Wed Nov 01, 2006 4:36 pm

    Re: VARMA GARCH Model

    Unread post by TomDoan »

    Certainly your preliminary analysis shows that a VAR(1) looks adequate. (You might want to rename your data set as something more appropriate---it obviously isn't exchange rates). And you're right that with that much (or little) data, you can't really look at a model much more complicated than that.

    The problem with trying to interpret this as the authors do in that paper is that, if there is a very weak GARCH effect on output (which appears to be the case), it's very hard to estimate the effect of the uncertainty in that (the "M" effect). Basically with a weak GARCH effect, the conditional standard deviation of output is nearly constant, so it is very hard to tell whether it has an effect on either variable.
    Post Reply