Ehrmann-Ellison-Valla(2003) Regime-dependent IRF's

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

Ehrmann-Ellison-Valla(2003) Regime-dependent IRF's

Postby TomDoan » Mon Sep 12, 2011 2:43 pm

This is a rough implementation of Ehrmann, Ellison, Valla (2003), "Regime-dependent impulse response functions in a Markov-switching vector autoregression model", Economics Letters, Vol. 78, pp. 295-299. The data set is a reconstruction rather than the author's original data set (from their working paper). This does MCMC rather than bootstrapping for the generation of error bands for the IRF's. It does two sets of impulse responses at each kept draw, and "interleaves" them so there are six "shocks" for use in @MCGRAPHIRF, in order the first in regime1, first in regime 2, second in regime 1, etc.

This model is estimated several different ways as part of the Structural Breaks and Switching Models course.

eev_mcmc.rpf
Estimation with MCMC including IRF's
(6.56 KiB) Downloaded 754 times

eev_reconstructed.rat
Data set (reconstructed)
(21.5 KiB) Downloaded 628 times
TomDoan
 
Posts: 3381
Joined: Wed Nov 01, 2006 5:36 pm

Re: Ehrmann-Ellison-Valla(2003) Regime-dependent IRF's

Postby stemonmat » Mon Feb 13, 2012 11:47 am

Dear Tom, I have a problem running the code. I get the following error

## SR3. Tried to Use Series Number 12007784, Only 6 Are Available
The Error Occurred At Location 531, Line 72 of MSSYSREGRESSION

when I execute

@mssysregression(states=2,switch=ch)
# logcutil logcpi logpoil
# constant logcutil{1 to 3} logcpi{1 to 3} logpoil{1 to 3}
stemonmat
 
Posts: 1
Joined: Mon Feb 13, 2012 11:26 am

Re: Ehrmann-Ellison-Valla(2003) Regime-dependent IRF's

Postby moderator » Tue Feb 14, 2012 5:23 pm

It looks like you are trying to run that with version 8.0? You'll need version 8.1 to run that example.

I believe you're at Banca d'Italia, which has a current update subscription and thus has version 8.1. If you can get whoever is in charge of the RATS license there to get you updated to version 8.1, that should eliminate the problem.

Regards,
Tom Maycock
moderator
Site Admin
 
Posts: 306
Joined: Thu Oct 19, 2006 4:33 pm

Re: Ehrmann-Ellison-Valla(2003) Regime-dependent IRF's

Postby nazif » Sat Mar 31, 2012 9:27 am

Dear Tom,
Is it possible to produce regime transition probabilities and also regime properties similar to original Ox code of Ehrmann?
and I come to another question when I am plotting irfs. Could you please explain to me what are irf(3,8) and irf(4,8) in the four-variable system? for example is irf(3,8) the response of the third variable to the fourth shock in the second regime?
Thanks
Nazif
nazif
 

Re: Ehrmann-Ellison-Valla(2003) Regime-dependent IRF's

Postby TomDoan » Sat Mar 31, 2012 10:19 am

nazif wrote:Dear Tom,
Is it possible to produce regime transition probabilities and also regime properties similar to original Ox code of Ehrmann?


Sure. You have to save the draws for the P matrices and analyze them.

nazif wrote:and I come to another question when I am plotting irfs. Could you please explain to me what are irf(3,8) and irf(4,8) in the four-variable system? for example is irf(3,8) the response of the third variable to the fourth shock in the second regime?


The i in IRF(i,j) is the variable whose response is being computed. The shocks are interleaved, so j=1 and j=2 are for the first shock in the two regimes; j=3 and j=4 for the second shock, etc. So j=8 is the 4th shock, 2nd regime.
TomDoan
 
Posts: 3381
Joined: Wed Nov 01, 2006 5:36 pm

Re: Ehrmann-Ellison-Valla(2003) Regime-dependent IRF's

Postby ege_man » Thu Jun 06, 2013 2:02 pm

Dear Tom,
We get some referee comments for our paper they are also asking variance decompositions. Therefore I would like to ask you if there is a code to calculate regime dependent forecast error decompositions based on markov regime regime switching models. I am using version 8.1
Thanks
ege_man
 
Posts: 10
Joined: Sat Jul 07, 2012 2:39 pm

Re: Ehrmann-Ellison-Valla(2003) Regime-dependent IRF's

Postby TomDoan » Thu Jun 06, 2013 3:55 pm

ege_man wrote:Dear Tom,
We get some referee comments for our paper they are also asking variance decompositions. Therefore I would like to ask you if there is a code to calculate regime dependent forecast error decompositions based on markov regime regime switching models. I am using version 8.1
Thanks


FEVD's aren't really compatible with the IRF analysis, since the IRF's are using Choleski factors standardized to unit variances to highlight the differences in dynamics rather than the differences in variances.

The two calculations that look like:

compute factor=%decomp(sigmav(1)),factor=factor*inv(%diag(%xdiag(factor)))
impulse(noprint,model=MSSysRegModel,results=impulses1,steps=steps,factor=factor)

would need to have IMPULSE replaced with ERRORS, and would need to use just the %DECOMP(...) factor rather than the rescaled one.
TomDoan
 
Posts: 3381
Joined: Wed Nov 01, 2006 5:36 pm

Re: Ehrmann-Ellison-Valla(2003) Regime-dependent IRF's

Postby ege_man » Sat Jul 06, 2013 12:11 pm

Dear Tom,
Thanks for your quick help. I will try to modify my codes and get back to you if there is any problem.
ege_man
 
Posts: 10
Joined: Sat Jul 07, 2012 2:39 pm

Re: Ehrmann-Ellison-Valla(2003) Regime-dependent IRF's

Postby rawraw » Tue Oct 01, 2013 12:14 am

Hi, tom

I am confused about "Draw 'xxxx' Redrawing regimes with regime of size 'x.xx' " in running "Draw the regimes" of the code(x means a integer),and it was still redrawing after 12 hours, i had to abort it.my model contain 3 variables, sample period:2002M02-2013M03,lag order is 2 based on hq.Thanks a million.

Best wishes
rawraw
 
Posts: 11
Joined: Sat Sep 28, 2013 2:29 am

Re: Ehrmann-Ellison-Valla(2003) Regime-dependent IRF's

Postby TomDoan » Tue Oct 01, 2013 8:37 am

rawraw wrote:Hi, tom

I am confused about "Draw 'xxxx' Redrawing regimes with regime of size 'x.xx' " in running "Draw the regimes" of the code(x means a integer),and it was still redrawing after 12 hours, i had to abort it.my model contain 3 variables, sample period:2002M02-2013M03,lag order is 2 based on hq.Thanks a million.

Best wishes


That's a rather strong indication that the second regime isn't necessary---it can't get more than five data points in one of the regimes.
TomDoan
 
Posts: 3381
Joined: Wed Nov 01, 2006 5:36 pm

Re: Ehrmann-Ellison-Valla(2003) Regime-dependent IRF's

Postby rawraw » Fri Oct 04, 2013 2:34 am

TomDoan wrote:
rawraw wrote:Hi, tom

I am confused about "Draw 'xxxx' Redrawing regimes with regime of size 'x.xx' " in running "Draw the regimes" of the code(x means a integer),and it was still redrawing after 12 hours, i had to abort it.my model contain 3 variables, sample period:2002M02-2013M03,lag order is 2 based on hq.Thanks a million.

Best wishes


That's a rather strong indication that the second regime isn't necessary---it can't get more than five data points in one of the regimes.

Thanks for your quick help.
rawraw
 
Posts: 11
Joined: Sat Sep 28, 2013 2:29 am

Re: Ehrmann-Ellison-Valla(2003) Regime-dependent IRF's

Postby rawraw » Sun Oct 06, 2013 8:44 pm

Hi, tom

Could you please explain to us what does IMPULSESk(i,j) mean?(k=1,2) what is the difference between IMPULSESk(i,j) and IRF(i,j)? Thanks.

Best wishes
rawraw
 
Posts: 11
Joined: Sat Sep 28, 2013 2:29 am

Re: Ehrmann-Ellison-Valla(2003) Regime-dependent IRF's

Postby TomDoan » Mon Oct 07, 2013 12:26 pm

IMPULSES1 are the responses in regime 1 and IMPULSES2 are the responses in regime 2. Those are generated for each draw and get combined into a single set of responses so @MCPROCESSIRF can process them together. IRF will have the medians after the post processing for the combined responses.
TomDoan
 
Posts: 3381
Joined: Wed Nov 01, 2006 5:36 pm

Re: Ehrmann-Ellison-Valla(2003) Regime-dependent IRF's

Postby TomDoan » Tue Oct 08, 2013 10:27 am

Just add this after the estimation is finished. This will do the responses to shocks normalized to unit impacts, as they do in the paper.

Code: Select all
@MSSysRegSetModel(regime=1)
compute factor=%decomp(sigmav(1)),factor=factor*inv(%diag(%xdiag(factor)))
impulse(noprint,model=MSSysRegModel,results=impulses1,steps=steps,factor=factor)
*
* Save IRF's for regime 2
*
@MSSysRegSetModel(regime=2)
compute factor=%decomp(sigmav(2)),factor=factor*inv(%diag(%xdiag(factor)))
impulse(noprint,model=MSSysRegModel,results=impulses2,steps=steps,factor=factor)
TomDoan
 
Posts: 3381
Joined: Wed Nov 01, 2006 5:36 pm

Re: Ehrmann-Ellison-Valla(2003) Regime-dependent IRF's

Postby rawraw » Tue Oct 08, 2013 9:38 pm

TomDoan wrote:Just add this after the estimation is finished. This will do the responses to shocks normalized to unit impacts, as they do in the paper.

Code: Select all
@MSSysRegSetModel(regime=1)
compute factor=%decomp(sigmav(1)),factor=factor*inv(%diag(%xdiag(factor)))
impulse(noprint,model=MSSysRegModel,results=impulses1,steps=steps,factor=factor)
*
* Save IRF's for regime 2
*
@MSSysRegSetModel(regime=2)
compute factor=%decomp(sigmav(2)),factor=factor*inv(%diag(%xdiag(factor)))
impulse(noprint,model=MSSysRegModel,results=impulses2,steps=steps,factor=factor)


I got "## SX11. Identifier STEPS is Not Recognizable. Incorrect Option Field or Parameter Order?>>>>ulses1,steps=steps,<<<<" when I add the code after the EM estimation is finished ,what can I do next? Thanks!
rawraw
 
Posts: 11
Joined: Sat Sep 28, 2013 2:29 am

Next

Return to Examples and Sample Code

Who is online

Users browsing this forum: No registered users and 1 guest