Dueker (1997) + TVTP

Discussion of models with structural breaks or endogenous switching.
g_defi
Posts: 12
Joined: Fri Nov 19, 2010 8:42 am

Dueker (1997) + TVTP

Unread post by g_defi »

Dear Tom,

I am trying to extend the MS-GARCH-NF Dueker (1997) to allow time varying transition probabilities.
Unfortunately, I failed to modify correctly the following function:

Code: Select all

**************************************************************************
*
* This does a single step of the Dueker (approximate) filter
*
function DuekerFilter time
type integer 		time
*
local real       	e
local vector      fvec evec hvec ph
*
dim fvec(nexpand) evec(nstates)
*
* Compute the "H" matrices for each expanded regime
*
compute hvec=GARCHRegimeH(time)
*
* Compute the residuals for each current regime
*
compute evec=GARCHRegimeResids(time)
*
* Compute the likelihood for each expanded regime.
*
do i=1,nexpand
   compute e=evec(%MSLagState(i,1))
   compute fvec(i)=%if(hvec(i)>0,exp(%logtdensity(hvec(i)*gv(%MSLagState(i,0)),e,nu)),0.0)
end do i
*
* Do a filter step to update the probabilities. The log likelihood
* element is returned in the LOGF option.
*
@MSFilterStep(logf=DuekerFilter) time fvec
*
* Take probability weighted averages of the h's for each regime.
*
compute ph=pt_t(time).*hvec
compute pdiv  =%sumc(%reshape(pt_t(time),nstates,DFFilterSize))
compute phstar=%sumc(%reshape(ph,nstates,DFFilterSize))./pdiv
*
* Push them out into the HS vector
*
compute %pt(hs,t,phstar)
compute %pt(uus,t,evec.^2)
compute %pt(us,t,evec)
end
Thank you for any help offered.
Post Reply