Rolling-VAR-MGARCH-M

Discussions of ARCH, GARCH, and related models
hasanov
Posts: 46
Joined: Tue May 29, 2012 7:31 pm

Rolling-VAR-MGARCH-M

Unread post by hasanov »

The objectives of the code in the attached .RPF file are as follows:

- to estimate VARMA-MGARCH-in-mean model through the rolling windows where the fixed window size is 1250 and increment is 5.
- to generate 5-step ahead volatility forecasts in each window and save these series in hhat11 and hhat22 objects.
- this code also saves some of estimated coefficients from each regression in coef1, coef2, and coef3 objects.

I would be appreciated if anyone could check the code whether everything is OK. I suspect the mean model (i.e., VARMA) and var-cov model (i.e., MGARCH-M) use different sample periods.

Attached is the code file.

Many thanks

Code: Select all


*
set rvar1 = 100.0*(log(var1)-log(var1{1}))
set rvar2 = 100.0*(log(var2)-log(var2{1}))
set rvar3 = 100.0*(log(var3)-log(var3{1}))
*
source mvgarchfore.src
*
compute d=1250
*
dec series hhat11
dec series hhat22
dec series hhat33
*
dec series hhat12
dec series hhat13
dec series hhat23
*
clear hhat11
clear hhat22
clear hhat33
*
clear hhat12
clear hhat13
clear hhat23
*
clear coef1 coef2 coef3 coef4 coef5
clear tstat1 tstat2 tstat3 tstat4 tstat5
clear conv iter
*
dec vect[series] sqrth(3)
dec vect[series] eps(3)
dec symm[series] hhs(3,3)
clear(zeros) hhs
*
do regend = 2013:01:09, 2019:05:31, 5
*
equation oil_eq rvar1
# constant sqrth(1) sqrth(2) sqrth(3) rvar1{1} rvar2{1} rvar3{1}
equation rvar2_eq rvar2
# constant sqrth(1) sqrth(2) sqrth(3) rvar1{1} rvar2{1} rvar3{1}
equation rvar3_eq rvar3
# constant sqrth(1) sqrth(2) sqrth(3) rvar1{1} rvar2{1} rvar3{1}
*
group varmah oil_eq rvar2_eq rvar3_eq
*
clear(zeros) sqrth eps
*
do iters=1,3
   estimate(model=varmah,resids=resids)
   set eps(1) %regstart() * = resids(1)
   set eps(2) %regstart() * = resids(2)
   set eps(3) %regstart() * = resids(3)
end do iters
*
compute cv0=%sigma
*
garch(model=varmah, mv=bekk, robust, distrib=norm, rvectors=rv, hmatrices=hh, mvhseries=hhs, pmethod=simplex, piters=15, cvcrit=0.0001, iters=1000, presample=cv0,$
    uadjust=%pt(eps,t,rv(t)),hadjust=%(sqrth(1)=sqrt(hhs(1,1)), sqrth(2)=sqrt(hhs(2,2)), sqrth(3)=sqrt(hhs(3,3)))) regend-d+1 regend rvar1 rvar2 rvar3
*
@MVGarchFore(MV=BEKK, steps=5) hh rv
*
do i=1,5
compute hhat11(regend+i) = hh(regend+i)(1,1)
compute hhat22(regend+i) = hh(regend+i)(2,2)
compute hhat33(regend+i) = hh(regend+i)(3,3)
end do i
*
compute coef1(regend) = %beta(9)
compute coef2(regend) = %beta(10)
compute coef3(regend) = %beta(11)
compute coef4(regend) = %beta(38)
compute coef5(regend) = %beta(44)
*
compute tstat1(regend) = %tstats(9)
compute tstat2(regend) = %tstats(10)
compute tstat3(regend) = %tstats(11)
compute tstat4(regend) = %tstats(38)
compute tstat5(regend) = %tstats(44)
*
compute conv(regend) = %converged
compute iter(regend) = %ITERS
*
end do regend
*
*
print / coef1 tstat1 coef2 tstat2 coef3 tstat3
*
print / coef4 tstat4 coef5 tstat5
*
print / hhat11 hhat22 hhat33
*
print / conv iter


Last edited by hasanov on Fri Nov 15, 2019 5:30 pm, edited 10 times in total.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Rolling-VAR-MGARCH-M

Unread post by TomDoan »

That would be fine except that you're doing an asymmetric BEKK and there is no closed form forecasting procedure for an asymmetric BEKK.
hasanov
Posts: 46
Joined: Tue May 29, 2012 7:31 pm

Re: Rolling-VAR-MGARCH-M

Unread post by hasanov »

Thanks Tom!

How about the forecasts generated by procedure (i.e., @MVGarchFore(MV=BEKK, steps=5) hh rv) in the code? Does this procedure ignore the asymmetric component and produce forecasts?

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

Re: Rolling-VAR-MGARCH-M

Unread post by TomDoan »

Correct. Because it does the closed-form calculation, it ignores the asymmetry, but your estimates include it, so the forecasts won't be correct.

Note, by the way, that your model has a lot of quite insignificant coefficients, particularly in the mean model. Pick the mean model that's appropriate for your data, not someone else's.
hasanov
Posts: 46
Joined: Tue May 29, 2012 7:31 pm

Re: Rolling-VAR-MGARCH-M

Unread post by hasanov »

Many thanks for your prompt reply. Actually, the data is used for preliminary coding purposes. We plan to use the code for different set of data.

Kind Regards,
hasanov
Posts: 46
Joined: Tue May 29, 2012 7:31 pm

Re: Rolling-VAR-MGARCH-M

Unread post by hasanov »

Hi Tom,

It is clear that

%BETA - vector for the coefficients
%TSTATS - t-stats for the coefficients
%STDERRS - vector of coefficient standard errors

How about the p-values? Is there any specific vector for p-values?

Thanks
Last edited by hasanov on Tue Sep 11, 2018 10:25 pm, edited 1 time in total.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Rolling-VAR-MGARCH-M

Unread post by TomDoan »

No. But you can get those from the t-stats fairly easily. Note, BTW, that "rolling sample" GARCH models are really not a good idea. Fixing the start, and moving the end to do simulated out-of-sample forecasts has some value. Moving the start along with the end isn't well-motivated.
hasanov
Posts: 46
Joined: Tue May 29, 2012 7:31 pm

Re: Rolling-VAR-MGARCH-M

Unread post by hasanov »

Hi Tom,

In the procedure below:

@MVGarchFore(MV=BEKK, steps=1) hh rv

Does rv contain fitted values of returns or errors?

How elements of rv vector can be extracted? What commands can be used?

Many Thanks
Last edited by hasanov on Tue Dec 11, 2018 7:13 pm, edited 1 time in total.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Rolling-VAR-MGARCH-M

Unread post by TomDoan »

No. RV is input to the procedure---it should be what's produced by the RVECTORS option on GARCH. (Lagged residuals are needed to compute the out-of-sample forecasts).
wert12
Posts: 10
Joined: Thu Nov 15, 2018 2:47 am

Re: Rolling-VAR-MGARCH-M

Unread post by wert12 »

Dear hasanov, i would be most grateful if you could send me the data file.txt?
hasanov
Posts: 46
Joined: Tue May 29, 2012 7:31 pm

Re: Rolling-VAR-MGARCH-M

Unread post by hasanov »

Hi Tom,

I need to gather the convergence info for each rolling sample estimation and want to store it in a separate vector.

For example, coefficients are stored in %beta? Is there any object in RATS to store the convergence info?

I just need Yes" or "No" info for the numerical convergence for each rolling sample estimation.

Many thanks
Last edited by hasanov on Fri Apr 26, 2019 5:25 am, edited 1 time in total.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Rolling-VAR-MGARCH-M

Unread post by TomDoan »

hasanov
Posts: 46
Joined: Tue May 29, 2012 7:31 pm

Re: Rolling-VAR-MGARCH-M

Unread post by hasanov »

Hi Tom,

Once the rolling estimation has been done, I used "print / " option to get the results gathered in "ceof" and "hhat11". But it only shows the part of the results, not all of the results. How can I set to print all the results?

Many thanks
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Rolling-VAR-MGARCH-M

Unread post by TomDoan »

You have an active SMPL (which, so far as I can tell you never actually use):

smpl regend-d+1 regend roilf
smpl regend-d+1 regend rheatoilf

but that will affect a PRINT / ... instruction. So far as I can tell, you don't need those at all. (Note also that those third parameters on the SMPL's aren't part of the command and are ignored---I'm not sure what you intend those to mean).
hasanov
Posts: 46
Joined: Tue May 29, 2012 7:31 pm

Re: Rolling-VAR-MGARCH-M

Unread post by hasanov »

Hi Tom,

How can I obtain univariate or multivariate auto correlation test statistic for each window and store them in a separate object? Is it possible in RATS? Your advice is highly appreciated.

Thank you
Post Reply