Quite a few of these examples (switching space-space models and some of the simpler examples) are explained in much greater detail in the "Structural Breaks and Switching Models" e-course.
Kim and Nelson, State-space Models with Regime Switching
Kim and Nelson, State-space Models with Regime Switching
The attached zip has the examples and data files for Kim and Nelson, State-space Models with Regime Switching, 1999, MIT Press. The book demonstrates estimation of state-space models with Markov switching using both approximate maximum likelihood using the "Kim" filter and MCMC methods. In both cases, it starts with simpler models and works up, so the examples through kimnp126.rpf are for maximum likelihood and those starting with kimnp180.rpf are for MCMC.
Quite a few of these examples (switching space-space models and some of the simpler examples) are explained in much greater detail in the "Structural Breaks and Switching Models" e-course.
Quite a few of these examples (switching space-space models and some of the simpler examples) are explained in much greater detail in the "Structural Breaks and Switching Models" e-course.
Re: Kim and Nelson, State-space Models with Regime Switching
Hi Tom, thanks for posting these examples. I have a query on the setting of initial values in KIMNP111.RPF. Specifically the phi and x0 vectors
compute phi=||1.2,-.3||
compute sigsq=%seesq
*
frml kimf = kf=KimFilter(t),log(kf)
compute x0=||5.224,2.699||
Am I right to say the phi's are AR coefficients for loggdp? I'm not sure where the x0 values are derived from.
compute phi=||1.2,-.3||
compute sigsq=%seesq
*
frml kimf = kf=KimFilter(t),log(kf)
compute x0=||5.224,2.699||
Am I right to say the phi's are AR coefficients for loggdp? I'm not sure where the x0 values are derived from.
Re: Kim and Nelson, State-space Models with Regime Switching
Yes. The phi's are the AR coefficients. The x0's are taken from the book. Since the pre-sample values are estimated (that is, x0 is considered to be free parameters), those really just need to be in the right ballpark. The published results in the book actually aren't quite right---Kim cleaned up the code after the book went to press.mob7 wrote:Hi Tom, thanks for posting these examples. I have a query on the setting of initial values in KIMNP111.RPF. Specifically the phi and x0 vectors
compute phi=||1.2,-.3||
compute sigsq=%seesq
*
frml kimf = kf=KimFilter(t),log(kf)
compute x0=||5.224,2.699||
Am I right to say the phi's are AR coefficients for loggdp? I'm not sure where the x0 values are derived from.
Re: Kim and Nelson, State-space Models with Regime Switching
Hello Mr. Doan,
I try to execute kimnp115 procudure with my own data set. However some standart errors have negative sign.Also standart errors transition probabilities are 0 all the time. What should I do for this situation?
I try to execute kimnp115 procudure with my own data set. However some standart errors have negative sign.Also standart errors transition probabilities are 0 all the time. What should I do for this situation?
Re: Kim and Nelson, State-space Models with Regime Switching
The negative "standard deviations" aren't a problem as they get squared to produce the variance, so the sign is arbitrary.
Note that if there is no actual switching much of the model is unidentified, and you get results that make little sense. Have you done the simpler models to see whether they seem to be adequate?
Note that if there is no actual switching much of the model is unidentified, and you get results that make little sense. Have you done the simpler models to see whether they seem to be adequate?
Re: Kim and Nelson, State-space Models with Regime Switching
Thanks for your fast response.
Yes I did. When I executed the same code to the AR(1) model, the standard errors of the transition probabilities were zero.
Yes I did. When I executed the same code to the AR(1) model, the standard errors of the transition probabilities were zero.
Re: Kim and Nelson, State-space Models with Regime Switching
How did you do the "Hamilton" model (simpler switching AR?) The K&N text has two examples---one with the 1984 data (which works fine), the other with 1995 data (which doesn't, and requires a great deal of finesse to even get anywhere).