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

Use this forum for posting example programs or short bits of sample code.
zipop
Posts: 17
Joined: Thu Sep 05, 2013 4:52 am

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

Unread post by zipop »

thanks.
does this mean that my problem does not have a solution in this framework? I do not see how easily i can use the function ESTIMATE to set up a VAR after the MS parameters have been estimated. could you please further help me on this?

i can put the MS parameters in the VAR tools as
compute svt1 =%decomp(inv(%nobs*sigmav(1)))
compute betaols1=betasys(1)
compute ncoef =%rows(betaols1)
compute wishdof=%nobs-ncoef
compute svt2 =%decomp(inv(%nobs*sigmav(2)))
compute betaols2=betasys(2)

but i do not know how to move from here to draw these paramters and make use of priors such as

specify(type=general,matrix=priormat,tight=.2, DECAY=1.0) 0.5

thanks for your help!
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

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

Unread post by TomDoan »

Setting up the system with a prior and doing ESTIMATE is simply a quick way to generate the information needed to make the HPRIOR matrix.
zipop
Posts: 17
Joined: Thu Sep 05, 2013 4:52 am

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

Unread post by zipop »

thanks. how would you set up the system with a prior and do ESTIMATE?
thanks
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

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

Unread post by TomDoan »

You were describing how you would do a (non-switching) BVAR. Exactly like that.
rosenazc6
Posts: 3
Joined: Thu Oct 24, 2013 9:21 pm

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

Unread post by rosenazc6 »

Dear Tom,

i am trying to do FEVD after running the regime dependent impulse response. I have read your earlier post on this. Shall I write ,

compute factor=%decomp(sigmav(1))
error(noprint,model=MSSysRegModel,results=error1,steps=8,factor=factor)

It would be grateful if you can tell whether I am doing it correctly.
All the best
Rosen
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

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

Unread post by TomDoan »

As it said in the response to the original question, there are two locations where it computes the impulse responses. You need to insert that code in each location.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

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

Unread post by TomDoan »

hashemelshafie wrote:Is it possible(manageable) to expand this to 5 variables?
Possible, yes. Manageable is a different issue. The number of free parameters is likely almost 50% larger, plus it's less likely that a two-regime model will take care of that many dependent variables.
lumengobobo46
Posts: 17
Joined: Mon May 02, 2011 2:35 pm

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

Unread post by lumengobobo46 »

Hi Tom

which line of the code should i change if i need to extend to identified VAR (structural VAR) rather than unrestricted VAR as it is the case here?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

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

Unread post by TomDoan »

That's much more complicated than a single line change. For maximum likelihood (EM is out of the question) you would have to overwrite

function %MSSysRegInitVariances
...

to build the regime-specific covariance matrices from the regime-specific structural parameters for the SVAR and

nonlin(parmset=regparms) betasys sigmav

would have to have SIGMAV (which is a 2 vector of covariance matrices) would have to be replaced with the parameters for the regime-specific SVAR's.

The code for handling switching covariance matrices is complicated by the fact that the likelihood is unbounded above (a well-known problem with switching variances). Most of the code in %MSSysRegInitVariances is to prevent the covariance matrices from getting too close to singular. That would probably be even more complicated if you were dealing with an SVAR.
rosenazc6
Posts: 3
Joined: Thu Oct 24, 2013 9:21 pm

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

Unread post by rosenazc6 »

Dear Tom,

After running a 3 variable markov switching var I am trying to do a f test to see whether my coefficients/intercepts are different.

I was trying to test whether betasys(1)(1,1) and betasys(2)(1,2) are different. I give the following command

restrict 1
# 1 13
# 1 -1 0

i get `## Unassigned 1411'

it works till I am testing the 1st and the 12th coefficient variable.





It will be great if you can help me . I have attached the output file.





I
Attachments
f test.docx
(13.05 KiB) Downloaded 876 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

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

Unread post by TomDoan »

Are you estimating by EM? If so, you don't get a covariance matrix to let you do Wald tests---you need to at least finish it off with maximum likelihod.

You should also check how your software is installed. It's not finding the ratserrs.msg file with the executable (which is why you get the "unassigned" error message).
rosenazc6
Posts: 3
Joined: Thu Oct 24, 2013 9:21 pm

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

Unread post by rosenazc6 »

Dear Tom,

Thanks for you reply. I am using MCMC method.

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

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

Unread post by TomDoan »

The only thing that will give you usable Wald tests will be maximum likelihood. When you do the RESTRICT, it's trying to do a test using the last regression or whatever that actually produces the required information. That obviously has 12 coefficients.
ege_man
Posts: 85
Joined: Sat Jul 07, 2012 2:39 pm

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

Unread post by ege_man »

Dear Tom,
Is it possible to obtain irf's from the MS-VAR estimated with EM algorithm like in the original paper? I run the same model with the original Ox codes, my sample covers quarterly observations for 1988-2013 period, estimation gives me completely different regime classifications with stable irfs. However Rats estimates using mcmc have only four number of observations in one of the regime.
Regards
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

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

Unread post by TomDoan »

ege_man wrote:Dear Tom,
Is it possible to obtain irf's from the MS-VAR estimated with EM algorithm like in the original paper? I run the same model with the original Ox codes, my sample covers quarterly observations for 1988-2013 period, estimation gives me completely different regime classifications with stable irfs. However Rats estimates using mcmc have only four number of observations in one of the regime.
Regards
You can do this, which will give you the IRF's in impulses1 and impulses2. However, if you're getting only four observations in one of the regimes, then it sounds like you have more of an outlier than any actual switching model.

@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)
Post Reply