Retrieving PT_T from MSVARSETUP procedure

Discussion of models with structural breaks or endogenous switching.

Retrieving PT_T from MSVARSETUP procedure

Postby OSUPolisci » Fri Aug 10, 2012 3:12 pm

Dear Tom,

In your msvarsetup procedure, you write:

* It also sets up the following:
* Y = VECT[SERIES] of dependent variables
* PT_T,PT_T1 and PSMOOTH are SERIES[VECT] used for computing and saving
* the state probabilities.

How can I retrieve that PT_T vector? In my Series window, it appears as though it creates the Y vectors, but not the PT_T.

Thanks for your help!
OSUPolisci
 
Posts: 2
Joined: Thu May 17, 2012 9:01 am

Re: Retrieving PT_T from MSVARSEUP procedure

Postby TomDoan » Sat Aug 11, 2012 10:24 am

pt_t1, pt_t and the results from MSSmooth all have the same structure - they are SERIES of VECTOR's, which, since they aren't simple SERIES don't show up in the series window. This shows an example of extracting the smoothed and filtered probabilities of state 1 into simple series that you can graph, etc:

@%mssmooth p pt_t pt_t1 psmooth
*
* Smoothed probabilities of state 1
*
set p1smooth = psmooth(t)(1)
*
* Filtered probabiliities of state 1
*
set p1tt = pt_t(t)(1)
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Retrieving PT_T from MSVARSETUP procedure

Postby janas » Tue Jan 01, 2013 3:48 pm

Hi,
Using the following code, I cannot retrieve the filtered probabilities. I only get the smoothed probabilities. What's the problem?

cal 1999 01 12
all 50 2012:11

open data d:\Indicat\Contrat_Eurostat\rapport_2012\final\markov\Eurocoin\eurocoin_rat.xls
data(format=xls,org=obs) / dx

source(noecho) msregression.src

@MSRegression(switch=ch,states=4) dx
# constant

compute gstart=1999:01,gend=2012:11+0
@MSRegInitial gstart gend
@MSRegEMGeneralSetup
do emits=1,100
@MSRegEMStep gstart gend
end do emits

compute p=%xsubmat(p,1,nstates-1,1,nstates)
nonlin(parmset=regparms) betas sigsqv
nonlin(parmset=msparms) p
frml logl = f=%MSRegFVec(t),fpt=%MSProb(t,f),log(fpt)
@MSFilterInit
maximize(start=%(%MSRegInitVariances(),pstar=%msinit()),$
parmset=regparms+msparms,$
method=bhhh,iters=100,print) logl gstart gend

set p1smooth gstart gend = psmooth(t)(1)
set p2smooth gstart gend = psmooth(t)(2)
set p3smooth gstart gend = psmooth(t)(3)
set p4smooth gstart gend = psmooth(t)(4)

set p1filtre gstart gend = pt_t(t)(1)
set p2filtre gstart gend = pt_t(t)(2)
set p3filtre gstart gend = pt_t(t)(3)
set p4filtre gstart gend = pt_t(t)(4)

graph(footer="Probability of Regime",max=1.0,min=0.0) 1
# p4smooth

graph(footer="Probability of Regime",max=1.0,min=0.0) 1
# p4filtre


Furthermore, adding to this program the instruction you suggested (@%mssmooth p pt_t pt_t1 psmooth)
does'nt help in anyway, end even more erases the smoothed probabilities computed earlier.

Thank for your answer
eurocoin_rat.xls
(38.5 KiB) Downloaded 34 times
eurocoin.RPF
(1.76 KiB) Downloaded 34 times
janas
 
Posts: 2
Joined: Sun Dec 30, 2012 1:00 pm

Re: Retrieving PT_T from MSVARSETUP procedure

Postby TomDoan » Wed Jan 02, 2013 9:08 pm

Everything is fine after you're done with the EM iterations. Those compute pt_t and psmooth as side effects, so you can move the graphs up higher. The problem comes when you try to do the MAXIMIZE estimation. The model with 4 totally switching states has quite a few zero transition probabilities and you will have to deal with that in your parameter set, such as:

nonlin(parmset=msparms) p p(3,1)=0.0 p(1,3)=0.0 p(2,4)=0.0 p(3,4)=0.0
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Retrieving PT_T from MSVARSETUP procedure

Postby janas » Thu Jan 03, 2013 2:49 pm

Many thanks, Tom!
janas
 
Posts: 2
Joined: Sun Dec 30, 2012 1:00 pm


Return to Structural Breaks and Switching Models

Who is online

Users browsing this forum: No registered users and 1 guest

cron