VAR-GARCH-M
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.
http://www.estima.com/forum/viewtopic.php?f=8&t=1482
for an example of variance depending upon day of the week.
-
economics2012
- Posts: 51
- Joined: Thu Jan 19, 2012 4: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.
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.
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||
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||
-
economics2012
- Posts: 51
- Joined: Thu Jan 19, 2012 4:41 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.
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.
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||
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
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||
-
economics2012
- Posts: 51
- Joined: Thu Jan 19, 2012 4:41 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.
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: 51
- Joined: Thu Jan 19, 2012 4: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
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
Re: VAR-GARCH-M
Your VAR's aren't reporting missing values. You can't have NA gaps with a recursive calculation like the GARCH variance.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 ????
That's supposed to be ||%sigma(i,i),%sigma(i,i),%sigma(i,i),%sigma(i,i),%sigma(i,i),.20,.60||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||
(five repetitions of %sigma(i,i), one for each day of the week)
Re: VAR-GARCH-M
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.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
-
economics2012
- Posts: 51
- Joined: Thu Jan 19, 2012 4:41 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?
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.
Re: VAR-GARCH-M
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.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?
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.
-
economics2012
- Posts: 51
- Joined: Thu Jan 19, 2012 4:41 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
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
Re: VAR-GARCH-M
The GSTART, which is what is used by the MAXIMIZE, needs to be at least 1973:3 to allow space for two lags. This is discussed on page 293 of the version 8 User's Guide.
-
economics2012
- Posts: 51
- Joined: Thu Jan 19, 2012 4:41 pm
Re: VAR-GARCH-M
Hi Tom,
Running the code for daily data and accounting for the day of the week effect give me this result:
Does it mean that I have daily effect on Mondays and Wednesday?
Also,
If I want to check if I still have arch effect can I still run this code:
Many thanks
Running the code for daily data and accounting for the day of the week effect give me this result:
Code: Select all
MAXIMIZE - Estimation by BFGS
Convergence in 49 Iterations. Final criterion was 0.0000034 <= 0.0000100
Daily(5) Data From 1986:01:06 To 2009:12:31
Usable Observations 6258
Skipped/Missing (from 6259) 1
Function Value -22258.4669
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. B 0.005857982 0.004410815 1.32810 0.18414668
2. BVEC(1)(1) -0.017187612 0.014597341 -1.17745 0.23901671
3. BVEC(1)(2) 0.060123708 0.021574885 2.78675 0.00532403
4. BVEC(1)(3) 0.027542465 0.022599354 1.21873 0.22294747
5. BVEC(1)(4) 0.000000000 0.000000000 0.00000 0.00000000
6. BVEC(2)(1) 0.005762853 0.004441507 1.29750 0.19445938
7. BVEC(2)(2) 0.046190846 0.014068071 3.28338 0.00102570
8. BVEC(2)(3) 0.008901474 0.024577363 0.36218 0.71721617
9. BVEC(2)(4) 0.019904373 0.010230970 1.94550 0.05171458
10. GARCHP(1)(1) 0.439479548 0.164816862 2.66647 0.00766520
11. GARCHP(1)(2) -0.075708348 0.223201709 -0.33919 0.73446471
12. GARCHP(1)(3) 0.648279094 0.251471458 2.57794 0.00993904
13. GARCHP(1)(4) -0.441756737 0.235726974 -1.87402 0.06092786
14. GARCHP(1)(5) -0.005387029 0.168472383 -0.03198 0.97449140
15. GARCHP(1)(6) 0.104161327 0.009531225 10.92843 0.00000000
16. GARCHP(1)(7) 0.890580041 0.009501739 93.72811 0.00000000
17. GARCHP(2)(1) 0.115927112 0.024203096 4.78976 0.00000167
18. GARCHP(2)(2) -0.030752563 0.032670752 -0.94129 0.34655766
19. GARCHP(2)(3) 0.028886206 0.035109360 0.82275 0.41065049
20. GARCHP(2)(4) -0.011782383 0.034019800 -0.34634 0.72908798
21. GARCHP(2)(5) 0.011430565 0.025440282 0.44931 0.65320828
22. GARCHP(2)(6) 0.094695751 0.007201808 13.14889 0.00000000
23. GARCHP(2)(7) 0.893204379 0.008040614 111.08659 0.00000000
SIC for VAR 49376.60170
SIC for GARCH-M 44700.50774Also,
If I want to check if I still have arch effect can I still run this code:
Code: Select all
dec vect[series] ustd(%nvar)
clear(zeros) ustd
dec series[vect] garchu
compute %%garchinit()
gset garchu gstart gend = bb*yvec(t)-%%garchmu(t)
do time=gstart,gend
compute %pt(ustd,time,%solve(%decomp(hh(time)),garchu(time)))
end do time
@mvarchtest
# ustd
Last edited by economics2012 on Mon Jun 04, 2012 3:43 pm, edited 1 time in total.
Re: VAR-GARCH-M
Yes. That would be the interpretation.Does it mean that I have daily effect on Mondays and Wednesday?