Looping for VAR-BEKK GARCH Model

Discussions of ARCH, GARCH, and related models
lendraniestiko01
Posts: 5
Joined: Sun May 17, 2020 10:29 pm

Looping for VAR-BEKK GARCH Model

Unread post by lendraniestiko01 »

Hello everyone,

In the forum, it has been explained in order to run VAR-BEKK GARCH Model, the code is:

Code: Select all

system(model=varmodel)
variables y1 y2
lags 1 to number_of_lags_you_want
det constant
end(system)
*
garch(model=varmodel,mv=bekk,method=bfgs)
I have variables from X1, X2, ..... , Xn and i need to run pairwise-bivariate VAR(1)-BEKK GARCH(1,1) model with assumed one lag for each variables (Example: X1 and X2, X1 and X3,....... ,Xn-1 and xn). I am very new to RATS so i am not familiar with how the looping code works and i have been looking at the instructions manual but i have a difficult time to understand it as i have little experience with programming even with other stat programs

Can anyone help me on this?

Thank you for the assistance beforehand
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Looping for VAR-BEKK GARCH Model

Unread post by TomDoan »

To generate all pairs, you run an "I" loop over 1 to N-1 and inside it a loop from I+1 to N. (There are other equivalent ways to generate all pairs). This assumes the series are actually named Y1 to Yn (whatever the value of N is).

Code: Select all

do i=1,n-1
   do j=i+1,n
      system(model=varmodel)
      variables %s("Y"+i) %s("Y"+j)
      lags 1 to number_of_lags_you_want
      det constant
      end(system)
      *
      garch(model=varmodel,mv=bekk,method=bfgs)
   end do j
end do i
lendraniestiko01
Posts: 5
Joined: Sun May 17, 2020 10:29 pm

Re: Looping for VAR-BEKK GARCH Model

Unread post by lendraniestiko01 »

Thank you Tom for the reply,

It works well for me. Can i ask one more thing regarding this?

Unfortunately instead of having my variable named Y1 to YN, i have named my variables in following manner: typeofasset_countryof asset (example: eq_cn, eq_id,....,bm5_cn, bm5_id,...., bm10_cn, bm10_id,...,fx_cn, fx_id,...,mm_cn,mm_id,.....)

Understanding this, do you have any suggestion to generate all pairs?

Thank you again in advance.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Looping for VAR-BEKK GARCH Model

Unread post by TomDoan »

You want all pairs of those across all combinations of asset class and country?
lendraniestiko01
Posts: 5
Joined: Sun May 17, 2020 10:29 pm

Re: Looping for VAR-BEKK GARCH Model

Unread post by lendraniestiko01 »

Nevermind about my previous question because i found a way to work on it :D

Is there any way for me to store the result of all the estimation into one excel file? preferrably storing the name of the variables (and the matrix) containing coefficent and the significance
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Looping for VAR-BEKK GARCH Model

Unread post by TomDoan »

As I pointed out to another poster recently, you might want to decide what exactly it is that you want. The full output from a two-variable VAR(1) BEKK model is about 1/2 a printed page by itself---if you're doing a lot of models, that's not going to be useful. REPORT is the way to handle that, but you really want to decide what you need in the report before you get going on that.
lendraniestiko01
Posts: 5
Joined: Sun May 17, 2020 10:29 pm

Re: Looping for VAR-BEKK GARCH Model

Unread post by lendraniestiko01 »

Noted, it worked wonderfully

Thank you!
Post Reply