## VAR-GARCH-M

Discussions of ARCH, GARCH, and related models

### Re: VAR-GARCH-M

I just wanted to check for the lag length in the VAR using AIC/BIC criterion.

now I need to check for daily effect by adding days of the week dummies to the mean equation and the variance equation.

Many thanks for all your help.
economics2012

Posts: 62
Joined: Thu Jan 19, 2012 5:41 pm

### Re: VAR-GARCH-M

Hi Tom,

I believe for the mean equation that is how I add the dummy variables for the days of the week (Mondays through Thursdays):

system(model=basevar)
variables oilgrow stockreturns
lags 1 to nlags
det constant sqrthoil monday tuesday wednesday thursday
end(system)

Am I correct?

I am not sure how to add the dummies to the variance equation!

Thanks
economics2012

Posts: 62
Joined: Thu Jan 19, 2012 5:41 pm

### Re: VAR-GARCH-M

That's correct for the mean. See

http://www.estima.com/forum/viewtopic.php?f=8&t=1482

for an example of variance depending upon day of the week.
TomDoan

Posts: 2722
Joined: Wed Nov 01, 2006 5:36 pm

### Re: VAR-GARCH-M

Thanks a lot Tom. I will look at it.
economics2012

Posts: 62
Joined: Thu Jan 19, 2012 5:41 pm

### Re: VAR-GARCH-M

Hi Tom,

I have read the example but I believe that a bivariate model is more complicated than a univariate one.

I am trying to add the dummies in the variance equation as follows:

dec vect[equation] garchmeqns(%nvar)
dec vect[vect] bvec(%nvar)
dec vect[vect] garchp(%nvar)
do i=1,%nvar
compute garchmeqns(i)=%modeleqn(basevar,i)
compute bvec(i)=%eqncoeffs(garchmeqns(i))
compute garchp(i)=||%sigma(i,i)*(1-0.20-0.60)-M-T-W-H,.20,.60||
end do i

(where c=ht(1-a-b)-M-T-W-H. )

compute %%garchh=%zeros(%nvar,%nvar)
do i=1,%nvar
compute %%garchh(i,i)=garchp(i)(1)+garchp(i)(2)+garchp(i)(3)+garchp(i)(4)+garchp(i)(5)+garchp(i)(6)*uu(time-1)(i,i)+garchp(i)(7)*hh(time-1)(i,i)
end do i
end

compute b=0.0
function %%garchinit
compute bb=||1.0,0.0|b,1.0||
gset hh 1 gstart-1 = ||garchp(1)(1)+garchp(1)(2)+garchp(1)(3)+garchp(1)(4)+garchp(1)(5)/(1-garchp(1)(6)-garchp(1)(7))|0.0,garchp(2)(1)+garchp(2)(2)+garchp(2)(3)+garchp(2)(4)+garchp(2)(5)/(1-garchp(2)(6)-garchp(2)(7))||
gset uu 1 gstart-1 = hh(t)
end

P.S. where garchp(i)(2)+garchp(i)(3)+garchp(i)(4)+garchp(i)(5) stands for the dummies M, T, W, H.

Am I on the right track?

Thanks a lot.
economics2012

Posts: 62
Joined: Thu Jan 19, 2012 5:41 pm

### Re: VAR-GARCH-M

Your garchp(1)(2),...garchp(1)(4) are the parameters, and need to be multiplied by their dummies in the calculations of the %%garchh and gset hh.

If you follow the Baillie-Bollerslev parameterization, you would actually use seven parameters for the GARCH in each variable, with garchp(x)(1),...,garchp(x)(5) as the variances for days Monday to Friday and garchp(x)(6) and garchp(x)(7) as the two "GARCH" lag parameters. The %%garchh variances are then computed using

compute %%garchh(i,i)=(1-garchp(i)(6)-garchp(i)(7))*(garchp(i)(1)*M+garchp(i)(2)*T+garchp(i)(3)*W+garchp(i)(4)*H+garchp(i)(5)*F)+\$
garchp(i)(6)*uu(time-1)(i,i)+garchp(i)(7)*hh(time-1)(i,i)

and

gset hh = 1 gstart-1 = ||garchp(1)(1)*M+...+garchp(1)(5)*F|0.0,garchp(2)(1)*M+...+garch2(5)*F||

The guess values will be

compute garchp(i)=||%sigma(i,i),...total of 5...,%sigma(i,i),.20,.60||
TomDoan

Posts: 2722
Joined: Wed Nov 01, 2006 5:36 pm

### Re: VAR-GARCH-M

Thanks a lot Tom, but I am having an error here, can you please help identifying it?
Last edited by economics2012 on Mon Jun 04, 2012 1:42 pm, edited 2 times in total.
economics2012

Posts: 62
Joined: Thu Jan 19, 2012 5:41 pm

### Re: VAR-GARCH-M

You can't use T for a series name since it's a reserved name (for the SET time index).

I didn't change the name in this, but because this isn't part of a SET, the dummies need "TIME" subscripts.

Code: Select all
function %%garchh time
type symm %%garchh
type integer time
*
compute %%garchh=%zeros(%nvar,%nvar)
do i=1,%nvar
compute %%garchh(i,i)=(1-garchp(i)(6)-garchp(i)(7))*(garchp(i)(1)*M(time)+garchp(i)(2)*T(time)+garchp(i)(3)*W(time)+garchp(i)(4)*H(time)+garchp(i)(5)*F(time))+\$
garchp(i)(6)*uu(time-1)(i,i)+garchp(i)(7)*hh(time-1)(i,i)
end do i
end

I had a stray = on this:

gset hh 1 gstart-1 = ||garchp(1)(1)*M+garchp(1)(2)*T+garchp(1)(3)*W+garchp(1)(4)*H+garchp(1)(5)*F|0.0,garchp(2)(1)*M+garchp(2)(2)*T+garchp(2)(3)*W+garchp(2)(4)*H+garchp(2)(5)*F||
TomDoan

Posts: 2722
Joined: Wed Nov 01, 2006 5:36 pm

### Re: VAR-GARCH-M

I still don't understand this one:

compute garchp(i)=||%sigma(i,i),1,1,1,1,1,%sigma(i,i),.20,.60||

Again, many thanks for all your help.
Last edited by economics2012 on Mon Jun 04, 2012 1:43 pm, edited 1 time in total.
economics2012

Posts: 62
Joined: Thu Jan 19, 2012 5:41 pm

### Re: VAR-GARCH-M

Also, I don't see why you multiply by (1-garchp(i)(6)-garchp(i)(7)) below:

compute %%garchh=%zeros(%nvar,%nvar)
do i=1,%nvar
compute %%garchh(i,i)=(1-garchp(i)(6)-garchp(i)(7))*(garchp(i)(1)*M(time)+garchp(i)(2)*Tu(time)+garchp(i)(3)*W(time)+garchp(i)(4)*H(time)+garchp(i)(5)*F(time))+\$
garchp(i)(6)*uu(time-1)(i,i)+garchp(i)(7)*hh(time-1)(i,i)
end do i
end
economics2012

Posts: 62
Joined: Thu Jan 19, 2012 5:41 pm

### Re: VAR-GARCH-M

economics2012 wrote:## SR10. Missing Values And/Or SMPL Options Leave No Usable Data Points

Do you think the problem is in the daily data? I have gaps for holidays. So , I am not sure whether RATS daily format accept it ????

Your VAR's aren't reporting missing values. You can't have NA gaps with a recursive calculation like the GARCH variance.

economics2012 wrote:I still don't understand this one:

compute garchp(i)=||%sigma(i,i),1,1,1,1,1,%sigma(i,i),.20,.60||

That's supposed to be ||%sigma(i,i),%sigma(i,i),%sigma(i,i),%sigma(i,i),%sigma(i,i),.20,.60||

(five repetitions of %sigma(i,i), one for each day of the week)
TomDoan

Posts: 2722
Joined: Wed Nov 01, 2006 5:36 pm

### Re: VAR-GARCH-M

economics2012 wrote:Also, I don't see why you multiply by (1-garchp(i)(6)-garchp(i)(7)) below:

compute %%garchh=%zeros(%nvar,%nvar)
do i=1,%nvar
compute %%garchh(i,i)=(1-garchp(i)(6)-garchp(i)(7))*(garchp(i)(1)*M(time)+garchp(i)(2)*Tu(time)+garchp(i)(3)*W(time)+garchp(i)(4)*H(time)+garchp(i)(5)*F(time))+\$
garchp(i)(6)*uu(time-1)(i,i)+garchp(i)(7)*hh(time-1)(i,i)
end do i
end

You have to do that if the day-of-the-week effect is parameterized in terms of unconditional variances rather than variance intercepts. See the Baillie-Bollerslev article.
TomDoan

Posts: 2722
Joined: Wed Nov 01, 2006 5:36 pm

### Re: VAR-GARCH-M

Thanks a lot Tom, I will give it a try.

I do have another question. When I run the GARCH (1,2) OR GARCH(2,1) with one lag in the mean equation, I got errors! Can you please explain to me why?
Last edited by economics2012 on Mon Jun 04, 2012 1:44 pm, edited 4 times in total.
economics2012

Posts: 62
Joined: Thu Jan 19, 2012 5:41 pm

### Re: VAR-GARCH-M

economics2012 wrote:Thanks a lot Tom, I will give it a try.

I do have another question. When I run the GARCH (1,2) OR GARCH(2,1) with one lag in the mean equation, I got errors! Can you please explain to me why?

There's a "Code" button which will let you reformat 100 lines of program into an easier to manage and read code block. I would appreciate it if you would use it.

You need two lags for the GARCH process, but with lags=1 in the mean model, it can compute the mean model starting at period 2. Lagging back 2 in the variance equation takes it out of sample (to entry 0). You'll have to bump the start period up by one to accomodate the added GARCH equation lag. If your mean equation has more lags, it isn't defined until 3 or later, so there's room for the GARCH lags.
TomDoan

Posts: 2722
Joined: Wed Nov 01, 2006 5:36 pm

### Re: VAR-GARCH-M

I am sorry I didn't know about the "code" button.

I am not sure I got it right. So, do you mean that I need to start the data from 1973:2 instead of 1973:1 ?

Many thanks
economics2012

Posts: 62
Joined: Thu Jan 19, 2012 5:41 pm

PreviousNext

### Who is online

Users browsing this forum: No registered users and 0 guests