Hafner Herwartz 2006

Use this forum for posting example programs or short bits of sample code.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Hafner Herwartz 2006

Unread post by TomDoan »

hafner_herwartz_jimf2006.zip is a replication file for the analysis in Hafner and Herwartz(2006), "Volatility impulse responses for multivariate GARCH models: An exchange rate illustration", Journal of International Money and Finance, vol 25, no 5, 719-740. The data set is a reproduction, so the results are similar but don't quite match.

The same relatively simple VIRF calculation can be applied to MV-GARCH models estimated with STANDARD (or DVECH) which is the default for GARCH, BEKK, DBEKK, TBEKK, VECH or DIAGONAL (anything that admits a "VECH" representation). It does not work for other types of MV-GARCH models, or models with asymmetry.

The data set has irregular daily date (holidays omitted). The garchmodels_v10.rpf in the zip uses the newer handling of this using the JULIAN option on CALENDAR (added with version 10), and is quite a bit simpler as a result.

Detailed description
Bella
Posts: 6
Joined: Tue Aug 21, 2012 2:50 am

Re: Hafner Herwartz 2006

Unread post by Bella »

Dear Tom,
Hello
I would like to know whether the generalized Impulse Response and volatility Impulse Response in enclosed paper can be obtained using the method you have posted?
Taking the VARMA-GARCH-in-M-Asymmetric BEKK as a example, how can i make changes for the related code you have posted to estimate generalized Impulse Response and volatility Impulse Response in a VARMA-GARCH-in-M-Asymmetric BEKK model.

Thank you for your instructions.
Regards.
Bella.
Attachments
The Asymmetric E¤ects of Oil Price Shock.pdf
(397.05 KiB) Downloaded 1848 times
Bella
Posts: 6
Joined: Tue Aug 21, 2012 2:50 am

Re: Hafner Herwartz 2006

Unread post by Bella »

Thanks Tom. Here i have another question that is how i define the shock in the " compute hvec=%%vech_a*shock" in the part of "Use the VECH representation to compute the VIRF to the original shock" if I'd like to make volatility impulse responses of oil price and GDP in a bivariate varma-garch-m-asymmetric Bekk mode.

It is like that in the following in the Replication file for Hafner and Herwartz(2006)
sstats(max) / %if(date==920916,t,0)>>xblackwed %if(date==930802,t,0)>>xecpolicy
compute blackwed=fix(xblackwed),ecpolicy=fix(xecpolicy)
compute eps0=rv(blackwed)
compute sigma0=hh(blackwed)
compute shock=1.e+4*%vec(%outerxx(eps0)-sigma0)

but how i define eps0=rv(),sigma0=hh(), shock=1.e+4*%vec(%outerxx(eps0)-sigma0)? to make a simple volatility impulse responses.
lumengobobo46
Posts: 17
Joined: Mon May 02, 2011 2:35 pm

Re: Hafner Herwartz 2006

Unread post by lumengobobo46 »

Hi Tom

Any advice on how to obtain the confidence (95% for example) band for this VIF?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Hafner Herwartz 2006

Unread post by TomDoan »

lumengobobo46 wrote:Hi Tom

Any advice on how to obtain the confidence (95% for example) band for this VIF?
Random walk Metropolis-Hastings on the GARCH model would probably be the best bet.
jack
Posts: 160
Joined: Tue Sep 27, 2016 11:44 am

Re: Hafner Herwartz 2006

Unread post by jack »

Dear Tom,

Can I use the simple VIRF for tracing the effects of shocks on volatility equation (not mean equation) in a VAR-DCC or VAR-BEKk model?

The reference article is here:

http://boj.org.jm/uploads/pdf/papers_pa ... system.pdf
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Hafner Herwartz 2006

Unread post by TomDoan »

I have no idea what he's doing---there's no reference to Hafner and Herwartz, no technical description and no mention of the initial conditions (and who cares if it's a VAR---the mean model has no effect on the VIRF's).

At any rate, follow HH which does a BEKK model. There is no such thing as a simple VIRF for a DCC model.
jack
Posts: 160
Joined: Tue Sep 27, 2016 11:44 am

Re: Hafner Herwartz 2006

Unread post by jack »

Thanks for your reply.

Hafner and Herwartz have defined impulse-response for specific dates (Black Wednesday, Plaza and Louvre accord, ...). Can I use their procedure for general impulse-response like that of a VAR model?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Hafner Herwartz 2006

Unread post by TomDoan »

HH do a Volatility Impulse Reponse Function. That's a completely different thing than the IRF in a VAR. In standard IRF calculations, the mean of a residual is zero, so anything non-zero is a "shock". In a VIRF for a GARCH model, the residuals have an covariance matrix which is non-zero---not only non-zero, but time-varying. If the variance of component 1 is 4.0, then a residual of 1.0 is not a "shock", but exactly the opposite---it's of a size smaller than expected. That's why HH look at historical episodes---it gives you the baseline covariance matrix and an observable shock that exceeds that. Because (unlike standard IRF's) the VIRF's aren't linear in the shock size, there's no real point to any sort of standardized calculation.
Jules89
Posts: 140
Joined: Thu Jul 14, 2016 5:32 am

Re: Hafner Herwartz 2006

Unread post by Jules89 »

Dear Tom,

regarding confidence bands for VIRFs, does the 2nd edition of the GARCH course contain a method to derive them?
I saw that there is a chapter on simulating VIRFs. Could this be used?

Best

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

Re: Hafner Herwartz 2006

Unread post by TomDoan »

Jules89 wrote:Dear Tom,

regarding confidence bands for VIRFs, does the 2nd edition of the GARCH course contain a method to derive them?
I saw that there is a chapter on simulating VIRFs. Could this be used?

Best

Jules
No. The simulation method is for estimating VIRF's when the model doesn't allow for a closed-form calculation. That requires simulation (a rather considerable amount of it) just to get the point estimates. To get error bands on the VIRF's would require simulating over the parameters of the GARCH model itself. If you have enough data that the asymptotics are fairly good, you can probably do that with importance sampling or independence M-H over the entire model. Both the simulations to do VIRF and the types of simulations over the parameters are covered in separate sections---they just have to be combined into one analysis.
Jules89
Posts: 140
Joined: Thu Jul 14, 2016 5:32 am

Re: Hafner Herwartz 2006

Unread post by Jules89 »

Dear Tom,

regarding your suggestion above. I had a quick look at the table of contents of the volatility E-course. Does it provide an example of an MCMC estimator for GARCH-BEKK models? I couldn't find that.
If it doesn't, is there some RATS code available?

Best

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

Re: Hafner Herwartz 2006

Unread post by TomDoan »

Not for a BEKK. There's an example which does a DCC GARCH model, and there is also a detailed description of the SVAR-GARCH-M model of Elder and Serletis. A BEKK shouldn't be all that difficult, at least if you have enough data that the asymptotics are pretty good.
Jules89
Posts: 140
Joined: Thu Jul 14, 2016 5:32 am

Re: Hafner Herwartz 2006

Unread post by Jules89 »

Dear Tom,

I have two questions regarding MCMC estimation of the BEKK model:

1)

I went through the MCMC code for the DCC-GARCH. Wouldn't it be possible to estimate a BEKK model with the similar procedure? I start with the ML estimates, then I generate candidate draws with the t-distribution and evaluate it using:

Code: Select all

compute btest=blast+%ranmvt(fxx,nuxx)
garch(p=1,q=1,mv=bekk,initial=btest,method=eval,$
rvectors=rv,hmatrices=htest) / xjpn xfra xsui
compute logptest=%logl
The rest should be the same.

2)
Above would be Random Walk MH, why do you think that independence MH is better suited?

Best

Jules
Post Reply