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 requires version 8.1 or later.

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 829 times

eev_reconstructed.rat
Data set (reconstructed)
(21.5 KiB) Downloaded 667 times
TomDoan
 
Posts: 3667
Joined: Wed Nov 01, 2006 5:36 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: 3667
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: 20
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: 3667
Joined: Wed Nov 01, 2006 5:36 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: 10
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: 3667
Joined: Wed Nov 01, 2006 5:36 pm

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: 10
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: 3667
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: 3667
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: 10
Joined: Sat Sep 28, 2013 2:29 am

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

Postby TomDoan » Tue Oct 08, 2013 10:20 pm

You have to define STEPS as the number of steps of IRF's that you want.
TomDoan
 
Posts: 3667
Joined: Wed Nov 01, 2006 5:36 pm

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

Postby rawraw » Wed Oct 09, 2013 12:19 am

TomDoan wrote:You have to define STEPS as the number of steps of IRF's that you want.

Thanks!
(1) What do "k","i","j" in IMPULSES"k"(i,j) mean?
(2) I can get the IMPULSES"k"(i,j),but how can I get the IRF(i,j),LOWER(i,j),UPPER(i,j) in EM algorithm?
(3) There is only P(1,1) in results of EM estimation,so how can I get P(2,2)?P(2,2)=1-P(1,2) ?
(4) There is only BETA in results of EM estimation, how can I get BETASYS(k)(i,j)?
The code please! Thanks again.
rawraw
 
Posts: 10
Joined: Sat Sep 28, 2013 2:29 am

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

Postby TomDoan » Wed Oct 09, 2013 8:10 am

rawraw wrote:(1) What do "k","i","j" in IMPULSES"k"(i,j) mean?


I answered about the K above. IMPULSE defines its results as an array of series where i is the target variable and j is the shock.

rawraw wrote:(2) I can get the IMPULSES"k"(i,j),but how can I get the IRF(i,j),LOWER(i,j),UPPER(i,j) in EM algorithm?


You can't. That's why we didn't put IRF's into the EM and ML programs.

rawraw wrote:(3) There is only P(1,1) in results of EM estimation,so how can I get P(2,2)?P(2,2)=1-P(1,2) ?


EM actually generates the whole matrix. It's cut down to P(1,1), P(1,2) for the ML polishing by

compute p=%xsubmat(p,1,1,1,2)

If you add

compute pmatrix=p

before that, you can then reference the whole matrix as pmatrix.

rawraw wrote:(4) There is only BETA in results of EM estimation, how can I get BETASYS(k)(i,j)?


The NONLIN needs to be changed to

nonlin(parmset=regparms) betasys sigmav
TomDoan
 
Posts: 3667
Joined: Wed Nov 01, 2006 5:36 pm

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

Postby rosen » Mon Nov 04, 2013 6:33 am

Dear Tom,

I am new to rats and having some problems . I am running a 3 variable ms-var simailar to ehrmann -ellison-valla(2003). I am estimating it with em. I want to generate negative shocks . My three variables are house price growth (hpp) , real gdp growth rate (gdpp) and change in monetary policy. i have attached my file. I tried the flipper option but it doesn't work. It would be great if you have a look (attached file: var4) Hi taom I have attached the data set.

My second question is is it possible to generate the standard errors using boot straps in my work.
It would be realy great if you can help me.
All the best

Rosen
Attachments
stata.csv
(8.15 KiB) Downloaded 30 times
var4.RPF
file trying to generate negative shock
(1.96 KiB) Downloaded 44 times
var3.RPF
(1.9 KiB) Downloaded 36 times
rosen
 
Posts: 1
Joined: Thu Oct 31, 2013 9:45 am

Next

Return to Examples and Sample Code

Who is online

Users browsing this forum: No registered users and 2 guests

cron