Retrieving PT_T from MSVARSETUP procedure

Discussion of models with structural breaks or endogenous switching.
OSUPolisci
Posts: 2
Joined: Thu May 17, 2012 9:01 am

Retrieving PT_T from MSVARSETUP procedure

Unread post by OSUPolisci »

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!
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Retrieving PT_T from MSVARSEUP procedure

Unread post by TomDoan »

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)
janas
Posts: 2
Joined: Sun Dec 30, 2012 12:00 pm

Re: Retrieving PT_T from MSVARSETUP procedure

Unread post by janas »

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 924 times
eurocoin.RPF
(1.76 KiB) Downloaded 1202 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Retrieving PT_T from MSVARSETUP procedure

Unread post by TomDoan »

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
janas
Posts: 2
Joined: Sun Dec 30, 2012 12:00 pm

Re: Retrieving PT_T from MSVARSETUP procedure

Unread post by janas »

Many thanks, Tom!
Post Reply