Elder-Serletis(2010) VAR-GARCH-M

Use this forum for posting example programs or short bits of sample code.

Elder-Serletis(2010) VAR-GARCH-M

Postby TomDoan » Wed Sep 21, 2011 1:40 pm

Updated 18 June 2013 to add many additional comments to both programs, and (in the oilgdpgarchirf program), to use Random Walk Metropolis (rather than Independence Chain) and change how the "without" M effect is done.

This is a replication file for the oil price-GDP bivariate VAR-GARCH-M model from Elder and Serletis(2010), "Oil Price Uncertainty", Journal of Money, Credit and Banking, Vol. 42, No. 6, 1137-1159. This uses a diagonal GARCH-M model on two structural shocks with the square root of the current oil shock variance entering the VAR as a shift variable. There's a Choleski factorization to map the structural shocks to the variables themselves.

Unlike many types of non-linear models, the impulse responses in this model aren't dependent upon the lagged values of the dependent variables. However, they aren't linear in the shock size because of the GARCH variance depends upon the square and that propagates through. Positive and negative shocks have different effects. The "IRF" program computes the responses of GDP to shocks (with either sign) of a "typical" size in oil prices. It also computes the responses on a model estimated without the "M" effect. Error bands are computed by Random Walk Metropolis.

Note that there are a number of features of this model which are specific to this being a combination of an (very flexible) oil price and a sluggishly moving macro aggregate like GDP. The constraint garchp(1)(3)=0.0 eliminates the GARCH lag term on the first structural shock. However, that's not a requirement of the model; it's there because, when the model is estimating without that constraint, that coefficient goes negative. The "M" effect is only on the oil price variance, and is only included in the GDP equation.

This requires version 8.0 or later, and for version 8.0, you also need the function on the MODELLAGMATRIX.SRC file. (That's built-in with 8.1 or later). Because that's a function (not a procedure), you need to do a

SOURCE MODELLAGMATRIX.SRC

instruction in order to make it usable. (Again, this isn't necessary with RATS 8.1 or later)

This example is covered in detail in the RATS ARCH/GARCH and Volatility Models e-course.

oilgdpgarch.rpf
Estimation of model
(4.62 KiB) Downloaded 187 times

oilgdpgarchirf.rpf
Calculation of IRF's with confidence bands (requires oilgdpgarch.rpf)
(7 KiB) Downloaded 159 times

Elder_Serletis_oil_prices_Real_GDP.txt
Data file
(4.78 KiB) Downloaded 512 times

modellagmatrix.src
Glue routine for %MODELLAGMATRIX (required with RATS v8.0 or earlier)
(888 Bytes) Downloaded 459 times
TomDoan
 
Posts: 3398
Joined: Wed Nov 01, 2006 5:36 pm

Re: Elder-Serletis(2010) VAR-GARCH-M

Postby TWG » Tue Sep 27, 2011 7:55 am

Tom, sorry but I have a new question, when I change the numbers of lags in the VAR I have this error in this part of the code,

maximize(trace,start=%%garchinit(),pmethod=simplex,piters=5,iters=500) garchmlogl gstart gend
## MAT13. Store into Out-of-Range Matrix or Series Element

How I can fix this problem?

Thank you very much

W
TWG
 
Posts: 10
Joined: Tue Jun 29, 2010 1:19 pm

Re: Elder-Serletis(2010) VAR-GARCH-M

Postby TomDoan » Tue Sep 27, 2011 9:12 am

The "10" in the last element of this depends upon the number of lags. (In general, it's %nvar*nlags+%nvar)

nonlin b bvec garchp garchp(1)(3)=0.0 bvec(1)(10)=0.0

The June 2013 version uses the meffectpos variable rather than hard-coding the 10
TomDoan
 
Posts: 3398
Joined: Wed Nov 01, 2006 5:36 pm

Re: Elder-Serletis(2010) VAR-GARCH-M

Postby Karen Chang » Wed Oct 10, 2012 7:18 pm

Dear Tom,

I am new to RATS and I am learning your codes for this paper. I have a question regarding to the following part of the codes:

do i=1,%nvar
compute garchmeqns(i)=%modeleqn(basevar,i)
compute bvec(i)=%eqncoeffs(garchmeqns(i))
compute garchp(i)=||%sigma(i,i)/5.0,.20,.60||
end do i

In particular, in the "compute garchp(i)=||%sigma(i,i)/5.0,.20,.60||", could you please tell me why you divide the covariance matrix by 5.0 and what are the intuitions about including these numbers 5.0, 0.2, 0.6 here?

Thank you very much,

KC
Karen Chang
 
Posts: 2
Joined: Mon Jul 23, 2012 12:06 am

Re: Elder-Serletis(2010) VAR-GARCH-M

Postby TomDoan » Wed Oct 10, 2012 8:29 pm

Karen Chang wrote:Dear Tom,

I am new to RATS and I am learning your codes for this paper. I have a question regarding to the following part of the codes:

do i=1,%nvar
compute garchmeqns(i)=%modeleqn(basevar,i)
compute bvec(i)=%eqncoeffs(garchmeqns(i))
compute garchp(i)=||%sigma(i,i)/5.0,.20,.60||
end do i

In particular, in the "compute garchp(i)=||%sigma(i,i)/5.0,.20,.60||", could you please tell me why you divide the covariance matrix by 5.0 and what are the intuitions about including these numbers 5.0, 0.2, 0.6 here?

Thank you very much,

KC


Elder's form of MV-GARCH uses a set of univariate GARCH's on orthogonalized components with a Choleski factor to convert those to the multivariate covariance model. GARCHP is a VECTOR of VECTORS, with GARCHP(i) being the vector of parameters for the ith of those underlying components. GARCHP(i)(1) is the constant, GARCHP(i)(2) is the lagged squared residual, and GARCHP(i)(3) is the lagged variance. So .2 and .6 are the guess values for the GARCH parameters (those are fairly standard). The unconditional variance of a GARCH(1,1) process is the GARCH constant/(1-sum of GARCH coefficients), so that first element backs out a guess value for the constant from the .2, the .6 and the sample variance. A clearer way to write that is

compute garchp(i)=||%sigma(i,i)*(1-.20-.60),.20,.60||
TomDoan
 
Posts: 3398
Joined: Wed Nov 01, 2006 5:36 pm

Re: Elder-Serletis(2010) VAR-GARCH-M

Postby Karen Chang » Mon Oct 15, 2012 2:34 pm

Dear Tom,

Thanks a lot for your help. I have two more questions need to ask you.

1). When I worked with my data without imposing constraints, I found my bvec(1)(10) is positive, therefore I did not impose the condition of garchp(1)(3)=0.0 in my estimation. However, do I need to keep the other constraint, bvec(1)(10)=0.0, in the estimation?
“nonlin b bvec garchp garchp(1)(3)=0.0 bvec(1)(10)=0.0”

2). When I worked with my data, my results show a positive log-likelihood value and the SIC numbers for both VAR and GARCH-M models are negative. What are the possible problems for my estimation and what should I do for it?
Here are the final results I got:

Code: Select all
MAXIMIZE - Estimation by BFGS
Convergence in    59 Iterations. Final criterion was  0.0000034 <=  0.0000100
Quarterly Data From 1977:02 To 2012:02
Usable Observations                       141
Function Value                       346.7100

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  B                                -0.435630301  0.027407864    -15.89435  0.00000000
2.  BVEC(1)(1)                   0.583446395  0.198091293      2.94534  0.00322599
3.  BVEC(1)(2)                   -0.194894012  0.169123267     -1.15238  0.24916558
4.  BVEC(1)(3)                    0.569579578  0.150184369      3.79254  0.00014912
5.  BVEC(1)(4)                    0.015050629  0.164622572      0.09143  0.92715485
6.  BVEC(1)(5)                   -0.300734313  0.280930893     -1.07049  0.28439784
7.  BVEC(1)(6)                   -0.351224404  0.267163688     -1.31464  0.18863050
8.  BVEC(1)(7)                   -0.629610675  0.262457032     -2.39891  0.01644398
9.  BVEC(1)(8)                   -0.228892944  0.243795109     -0.93887  0.34779532
10. BVEC(1)(9)                    0.004234282  0.009614583      0.44040  0.65964593
11. BVEC(1)(10)                   0.000000000  0.000000000      0.00000  0.00000000
12. BVEC(2)(1)                    0.199743013  0.048426527      4.12466  0.00003713
13. BVEC(2)(2)                    0.186365477  0.044661771      4.17282  0.00003009
14. BVEC(2)(3)                    0.121746111  0.047633660      2.55588  0.01059184
15. BVEC(2)(4)                   -0.068237292  0.047958643     -1.42284  0.15478365
16. BVEC(2)(5)                   -0.248402885  0.083405780     -2.97825  0.00289904
17. BVEC(2)(6)                   -0.446354785  0.077414274     -5.76579  0.00000001
18. BVEC(2)(7)                   -0.113966574  0.082516098     -1.38114  0.16723484
19. BVEC(2)(8)                    0.232440827  0.080290103      2.89501  0.00379144
20. BVEC(2)(9)                   -0.000834181  0.015964012     -0.05225  0.95832644
21. BVEC(2)(10)                   0.010861000  0.126691682      0.08573  0.93168280
22. GARCHP(1)(1)                  0.008053675  0.002574258      3.12854  0.00175676
23. GARCHP(1)(2)                  0.399551187  0.196490507      2.03344  0.04200833
24. GARCHP(1)(3)                  0.160484898  0.203009336      0.79053  0.42921852
25. GARCHP(2)(1)                  0.000120606  0.000133163      0.90570  0.36509365
26. GARCHP(2)(2)                  0.065757216  0.050247418      1.30867  0.19064665
27. GARCHP(2)(3)                  0.860034090  0.105452895      8.15562  0.00000000

SIC for VAR    -578.88184
SIC for GARCH-M    -569.70102

Thanks again,

KC
Karen Chang
 
Posts: 2
Joined: Mon Jul 23, 2012 12:06 am

Re: Elder-Serletis(2010) VAR-GARCH-M

Postby TomDoan » Mon Oct 15, 2012 9:17 pm

Karen Chang wrote:Dear Tom,

Thanks a lot for your help. I have two more questions need to ask you.

1). When I worked with my data without imposing constraints, I found my bvec(1)(10) is positive, therefore I did not impose the condition of garchp(1)(3)=0.0 in my estimation. However, do I need to keep the other constraint, bvec(1)(10)=0.0, in the estimation?
“nonlin b bvec garchp garchp(1)(3)=0.0 bvec(1)(10)=0.0”


That will depend upon the series that you're using. In the paper, the "M" effect was restricted to oil price variance in the GDP equation. This excludes oil price variance in the oil equation because it's a commodity market, not an equity market. If the second series were stock returns, you would want the M effect in that.

Karen Chang wrote:2). When I worked with my data, my results show a positive log-likelihood value and the SIC numbers for both VAR and GARCH-M models are negative. What are the possible problems for my estimation and what should I do for it?


The information criteria are based on -2 * logl and you're trying to minimize them, so that's expected.
TomDoan
 
Posts: 3398
Joined: Wed Nov 01, 2006 5:36 pm

Re: Elder-Serletis(2010) VAR-GARCH-M

Postby Trebor » Mon Mar 11, 2013 2:59 pm

Dear Tom,

I have a very simple question: which coefficient in the replication results corresponds to the H_1,1 coefficient on oil volatility in the paper? BVEC(1)(1)? The coefficient in the paper is -0.022** and it is significant.

Thank you very much for any help.

Replication results:

Code: Select all
MAXIMIZE - Estimation by BFGS
Convergence in    32 Iterations. Final criterion was  0.0000000 <=  0.0000100
Quarterly Data From 1975:02 To 2008:01
Usable Observations                       132
Function Value                     -1018.2568

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  B                                0.000774     0.002805      0.27593  0.78260154
2.  BVEC(1)(1)                       0.232173     0.100847      2.30222  0.02132265
3.  BVEC(1)(2)                      -0.039891     0.074804     -0.53328  0.59383892
4.  BVEC(1)(3)                       0.115321     0.083397      1.38279  0.16672893
5.  BVEC(1)(4)                       0.037788     0.078774      0.47970  0.63143803
6.  BVEC(1)(5)                       1.524741     1.213894      1.25607  0.20908885
7.  BVEC(1)(6)                      -1.578495     1.350727     -1.16863  0.24255419
8.  BVEC(1)(7)                      -0.958010     1.229460     -0.77921  0.43585470
9.  BVEC(1)(8)                       1.152616     1.158503      0.99492  0.31977584
10. BVEC(1)(9)                       0.922549     4.653518      0.19825  0.84285128
11. BVEC(1)(10)                      0.000000     0.000000      0.00000  0.00000000
12. BVEC(2)(1)                      -0.003224     0.003229     -0.99856  0.31800671
13. BVEC(2)(2)                      -0.001635     0.003202     -0.51058  0.60964757
14. BVEC(2)(3)                      -0.000042     0.003003     -0.01401  0.98882076
15. BVEC(2)(4)                      -0.004603     0.003050     -1.50908  0.13127717
16. BVEC(2)(5)                       0.186436     0.083041      2.24509  0.02476221
17. BVEC(2)(6)                       0.219818     0.096765      2.27168  0.02310607
18. BVEC(2)(7)                      -0.014732     0.086546     -0.17022  0.86483596
19. BVEC(2)(8)                      -0.015882     0.091826     -0.17296  0.86268408
20. BVEC(2)(9)                       3.204322     0.792331      4.04417  0.00005251
21. BVEC(2)(10)                     -0.021100     0.011219     -1.88063  0.06002265
22. GARCHP(1)(1)                  2046.954082   327.210271      6.25578  0.00000000
23. GARCHP(1)(2)                     0.421634     0.169772      2.48352  0.01300901
24. GARCHP(1)(3)                     0.000000     0.000000      0.00000  0.00000000
25. GARCHP(2)(1)                     0.222562     0.245797      0.90547  0.36521679
26. GARCHP(2)(2)                     0.185606     0.068065      2.72688  0.00639353
27. GARCHP(2)(3)                     0.800433     0.085905      9.31769  0.00000000

SIC for VAR    2188.01625
SIC for GARCH-M    2158.58360
Trebor
 
Posts: 3
Joined: Mon Oct 31, 2011 2:30 pm

Re: Elder-Serletis(2010) VAR-GARCH-M

Postby TomDoan » Mon Mar 11, 2013 8:38 pm

Trebor wrote:Dear Tom,

I have a very simple question: which coefficient in the replication results corresponds to the H_1,1 coefficient on oil volatility in the paper? BVEC(1)(1)? The coefficient in the paper is -0.022** and it is significant.

Thank you very much for any help.



It's BVEC(2)(10)
TomDoan
 
Posts: 3398
Joined: Wed Nov 01, 2006 5:36 pm

Re: Elder-Serletis(2010) VAR-GARCH-M

Postby miao » Mon Mar 25, 2013 10:27 pm

Hi Tom,

Following your reply that BVEC(2)(10) corresponds to the H_1,1 coefficient on oil volatility in the paper, could you check if my understanding is correct:

The model is

By = C + \Gamma_1 y_{t-1} + \Gamma_2 y_{t-2} +......+ \Gamma_p y_{t-p} + \Lambda(L) H^{1/2}_{t} +\epsilon_t

where y is a 2x1 column vector containing oil price change (1st element) and GDP growth (2nd element).
1.
In the B matrix, B(1,2)=0, B(1,1)=B(2,2)=1, and the only element to estimate is B(2,1), which corresponds to B in the program output.

2.
BVEC(1)(*)'s correspond to the oil equation, while B(2)(*) correspond to the GDP equation, and
y1=Oil price change
y2=GDP growth
y1(t)=BVEC(1)(1) + BVEC(1)(2)y1(t-1)+BVEC(1)(3)y2(t-1) + BVEC(1)(4)y1(t-2)+BVEC(1)(5)y2(t-2) + BVEC(1)(6)y1(t-3)+BVEC(1)(7)y2(t-3) + BVEC(1)(8)y1(t-4)+BVEC(1)(9)y2(t-4) + 0*H_{1,1} +\epsilon_{t1}
y2(t)=-B*y1(t)+ BVEC(2)(1) + BVEC(2)(2)y1(t-1)+BVEC(2)(3)y2(t-1) + BVEC(2)(4)y1(t-2)+BVEC(2)(5)y2(t-2) + BVEC(2)(6)y1(t-3)+BVEC(2)(7)y2(t-3) + BVEC(2)(8)y1(t-4)+BVEC(2)(9)y2(t-4) +BVEC(2)(10) *H_{1,1}^{1/2} +\epsilon_{t2}

3. Replacing real GDP series with Real personal consumption, Real investment, etc, then one can obtain all the other estimates of coefficients on H_{1,1}^{1/2} on Table 3, p1145, which is quoted below:

TABLE 3
COEFFICIENT ESTIMATES ON OIL VOLATILITY
Measure of real output Coefficient on H1,1(t)1/2, oil volatility
Real gross domestic product −0.022∗∗
(2.30)
Real gross domestic product (1967:1–2008:1) −0.011∗∗
West Texas Intermediate (2.47)
Real personal consumption expenditures: durable goods −0.107∗∗
(2.28)
Real gross private investment −0.153∗∗
(2.04)
Real PFI in nonresidential structures: commercial and health care −0.165∗∗
(2.39)
Real PFI in nonresidential structures: manufacturing −0.236
(1.47)
Real PFI in nonresidential structures: power and communication 0.022
(0.36)
Real PFI in nonresidential structures: mining, exploration, shafts −0.462∗∗
and wells (2.26)
Real PFI in nonresidential structures: other −0.183∗∗
(4.02)
Real PFI minus mining, exploration, shafts and wells −0.048
(1.37)
Real PFI nonresidential equipment and software −0.038
(1.00)
Industrial production monthly −0.017∗
(1.88)
NOTES: These are the parameter estimates for the free elements in  from the structural VAR with bivariate GARCH given by equations
(1) and (2) with εt ∼ N(0, Ht ). H1,1(t)1/2 denotes the conditional standard deviation of the relevant measure of oil prices. Absolute
asymptotic t-statistics are in parentheses. The measure of the real oil price is based on the refiner’s acquisition cost of crude and the sample
is 1975:02–2008:01, except as indicated.
∗∗Denotes significance at the 5% level.
∗Denotes significance at the 10% level.


Thank you for your patience!

Miao
miao
 
Posts: 20
Joined: Mon Mar 25, 2013 9:44 pm

Re: Elder-Serletis(2010) VAR-GARCH-M

Postby TomDoan » Sat May 25, 2013 10:58 am

That's correct. The coefficients don't match exactly because of minor differences in the calculations. The standard errors (and thus the significance **'s) are a bit more different since choice between BFGS, BFGS-Robust and BHHH standard errors can lead to quite different values.
TomDoan
 
Posts: 3398
Joined: Wed Nov 01, 2006 5:36 pm

Re: Elder-Serletis(2010) VAR-GARCH-M

Postby miao » Wed Jun 05, 2013 3:16 am

Dear Tom,

Could you check if I understand the model correctly:

H_{1,1}(t) = GARCHP(1)(1) + GARCHP(1)(2) *\epsilon_{t1}+ GARCHP(1)(3) * H_{1,1}(t-1)
H_{2,2}(t)= GARCHP(2)(1) + GARCHP(2)(2) *\epsilon_{t2}+ GARCHP(2)(3) *H_{2,2}(t-1)
with
\epsilon_{t1} and \epsilon_{t2} exactly equal to \epsilon_{t1} and \epsilon_{t2} in the mean equation.

Thanks,

Miao
miao
 
Posts: 20
Joined: Mon Mar 25, 2013 9:44 pm

Re: Elder-Serletis(2010) VAR-GARCH-M

Postby TomDoan » Wed Jun 05, 2013 9:46 am

The epsilon terms need to be squared, but otherwise, that's correct.
TomDoan
 
Posts: 3398
Joined: Wed Nov 01, 2006 5:36 pm

Re: Elder-Serletis(2010) VAR-GARCH-M

Postby miao » Fri Jun 14, 2013 4:20 am

Hi, Tom,

Thanks for your reply. I found from Elder’s dissertation, which built the same model as in the 2010 paper, that he conducted the LM test for omitted ARCH. First all he estimated a homoscedastic VAR, and then find the residual vector u_t = B^{-1}\epsilon_t. The components of u_t ‘s are tested separately by LM ARCH test. Though this procedure is not emphasized in the 2010 paper, I think it is necessary in order to make the argument rigorous.

Elder’s dissertation, 65th page of the pdf file
http://lamar.colostate.edu/~jelder/pape ... tation.pdf

1. He does not consider the ARCH test for u_t vector as a whole but consider the components separately. Do these two tests generally provide similar results?
2. Should the ARCH test on the (univariate) AR model generally provide similar results to the above two tests? I am thinking of building a bivariate model following their 2010 paper, and now I just have one of the data series. The other series is relatively harder to obtain. I wonder if the ARCH test on the univariate AR model could provide some guideline on the adequacy of applying their model.

Thanks,

Miao
miao
 
Posts: 20
Joined: Mon Mar 25, 2013 9:44 pm

Re: Elder-Serletis(2010) VAR-GARCH-M

Postby miao » Mon Jun 17, 2013 9:34 pm

Hi, Tom,

Following my last post:

1. Now I somehow understand why Elder 1995 consider the univariate tests instead of the multivariate test. Let us consider the 2010 paper case with oil (exogenous) and GDP. Since the impact of oil volatility on GDP is interested, one might need to conduct the ARCH test of oil residual in the bivariate VAR framework in order to justify the analysis of oil vol on GDP. The results of ARCH test on the bivariate model as a whole or on GDP are relatively uninterested. (Elder 2010 compares the BIC to justify the modeling.) Is it right?

2. The second part of the question still needs your response. Thank you!
miao
 
Posts: 20
Joined: Mon Mar 25, 2013 9:44 pm

Next

Return to Examples and Sample Code

Who is online

Users browsing this forum: No registered users and 1 guest

cron