Markov Switching Dynamic Factor Model a la Kim and Nelson

Discussion of State Space and Dynamic Stochastic General Equilibrium Models
allister
Posts: 20
Joined: Sun Jan 10, 2010 10:26 am

Markov Switching Dynamic Factor Model a la Kim and Nelson

Unread post by allister »

Hi Tom
I was wondering if you could assist me with coding on the model from the following paper "A Bayesian Approach to Testing for Markov Switching in Univariate and Dynamic Factor Models" of Kim and Nelson (1999). I tried to follow the programming that you posted about two months ago using the Stock and Watson model and trying to include the Gibbs sampler and the Markov Switching process as well but I have been running into tremendous amount of problems in doing so.

The authors actually have the code posted at http://www.econ.washington.edu/user/cne ... #chapter10 which I tried following as well but to no avail. I'll also attach a link to the paper as well http://www.econ.washington.edu/user/changjin/ier99.pdf.

As usual many thanks in advance for your usual cooperation and assistance in these matters
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Markov Switching Dynamic Factor Model a la Kim and Nelson

Unread post by TomDoan »

Here's the non-switching factor model done using Gibbs sampling, which is necessary to do the test. The posted Gauss code is written too much for the specifics of their model for my taste, which makes it harder to follow than it needs to be. This should be quite a bit easier to adjust. This is based upon the prior as described in the paper, not the one in the posted code. The differences there shouldn't matter all that much (it's the difference between very loose and even looser). However, this really needs many more Gibbs sweeps than the 1000 burn-in + 9000 keepers used in the paper---there's still quite a bit of sampling error in the estimates at those values.

Program:
swgibbs.rpf
(6.72 KiB) Downloaded 1600 times
Data file:
fulldta.prn
(29.43 KiB) Downloaded 1326 times
allister
Posts: 20
Joined: Sun Jan 10, 2010 10:26 am

Re: Markov Switching Dynamic Factor Model a la Kim and Nelson

Unread post by allister »

Thanks much Tom
Post Reply