Dynamic Factor Model with Regime Switching
Dynamic Factor Model with Regime Switching
Dear Tom,
I am studying the regime switching factor model as in Chauvet, M. (1998), An Econometric Characterization of Business Cycle Dynamics with Factor Structure and Regime Switching, International Economic Review, 39(4).
I had read e-coures on regime switching, however, I am still confused. Could you present its code?
Best reagrd
hardmann
I am studying the regime switching factor model as in Chauvet, M. (1998), An Econometric Characterization of Business Cycle Dynamics with Factor Structure and Regime Switching, International Economic Review, 39(4).
I had read e-coures on regime switching, however, I am still confused. Could you present its code?
Best reagrd
hardmann
Last edited by hardmann on Sun Dec 08, 2013 12:57 am, edited 1 time in total.
Re: regime switching factor model
That's not all that different from kimnp126.rpf example in Kim and Nelson's book. Have you tried doing the factor model without the Markov switching? That would be the first step.
Re: regime switching factor model
Dear Tom:
Thanks.
Estima had replicated results of book of Kim & Nelson, whoese applications came from the published papers. Why Estima directly give these of papers again. For most users, paper rather than book may be more availble.
Best ragard.
Hardmann
Thanks.
Estima had replicated results of book of Kim & Nelson, whoese applications came from the published papers. Why Estima directly give these of papers again. For most users, paper rather than book may be more availble.
Best ragard.
Hardmann
Re: regime switching factor model
If someone writes papers, then compiles them into a book, the chances are that the book examples have been improved and any errors from the papers corrected. Plus some of the book examples will not have come from previous work.
At any rate, kimnp126.rpf is based upon Chang-Jin Kim & Charles R. Nelson, 1998.
"Business Cycle Turning Points, A New Coincident Index, And Tests Of Duration Dependence Based On A Dynamic Factor Model With Regime Switching," The Review of Economics and Statistics, MIT Press, vol. 80(2), pages 188-201, May.
At any rate, kimnp126.rpf is based upon Chang-Jin Kim & Charles R. Nelson, 1998.
"Business Cycle Turning Points, A New Coincident Index, And Tests Of Duration Dependence Based On A Dynamic Factor Model With Regime Switching," The Review of Economics and Statistics, MIT Press, vol. 80(2), pages 188-201, May.
Re: regime switching factor model
Dear Tom:
I want estimate dynamic factor model with markov switching model. According to your advice, I am extensively learning Kim & Nelson's book(1999) " State space model with regime switching " and thier paper, Kim & Nelson(1998) "Business Cycle Turning Points, A New Coincident Index ...", and Stock & Watson(1991), "A Probability Model of the Coincident Economic Indicators ...".
I want to fullly imitate the kimnp126.rpf, example of Kim & Nelson books. I understand the Winrats codes of Stock & Watson(1991), whose coincident index can be gotten as fowllows codes"
set indicator_f 1997:2 * = xstates(t)(1)
acc indicator_f
In hamilton.rpf, smoothed probability can be gotten as follows:
@msvarsmoothed %regstart() %regend() psmooth
set pcontract %regstart() %regend() = psmooth(t)(2)
In kimnp126, how can extract coincident index, and filtered probability and smoothed probability.
Is smoothed probability as follows?
@mssmoothed %regstart() %regend() psmooth
Is filtered probability as follows?
set plow %regstart() %regend() = pt_t(t)(2)
Best Ragard
Hardmann.
I want estimate dynamic factor model with markov switching model. According to your advice, I am extensively learning Kim & Nelson's book(1999) " State space model with regime switching " and thier paper, Kim & Nelson(1998) "Business Cycle Turning Points, A New Coincident Index ...", and Stock & Watson(1991), "A Probability Model of the Coincident Economic Indicators ...".
I want to fullly imitate the kimnp126.rpf, example of Kim & Nelson books. I understand the Winrats codes of Stock & Watson(1991), whose coincident index can be gotten as fowllows codes"
set indicator_f 1997:2 * = xstates(t)(1)
acc indicator_f
In hamilton.rpf, smoothed probability can be gotten as follows:
@msvarsmoothed %regstart() %regend() psmooth
set pcontract %regstart() %regend() = psmooth(t)(2)
In kimnp126, how can extract coincident index, and filtered probability and smoothed probability.
Is smoothed probability as follows?
@mssmoothed %regstart() %regend() psmooth
Is filtered probability as follows?
set plow %regstart() %regend() = pt_t(t)(2)
Best Ragard
Hardmann.
Re: regime switching factor model
The answers to both are no. Neither "smoothing" method works independently on the combined model. To get smoothed estimates, you have to use Gibbs sampling.
Re: regime switching factor model
Dear Tom:
In kimnp126, how to get coincident index?
Hardmann
In kimnp126, how to get coincident index?
Hardmann
Re: regime switching factor model
The "Kim-filtered" estimate of the cycle (obtained by collapsing the regime-specific states) ishardmann wrote:Dear Tom:
In kimnp126, how to get coincident index?
Hardmann
set mycycle = xstates(t)(1)
Again, you can't get smoothed estimates without Gibbs sampling.
Re: regime switching factor model
Dear Tom:
In kimnp247, same model is estimated with Gibbs sampling. Its result are only,reported the mean, stdErr. For most bayesian estimation, including Kim & Nelson's book and paper, both prior (mean,stderr) and posterior (mean,stderr,median) are report. Why @mcmcpostproc does not report them? If can? How dose?
Best Regard
Hardmann
In kimnp247, same model is estimated with Gibbs sampling. Its result are only,reported the mean, stdErr. For most bayesian estimation, including Kim & Nelson's book and paper, both prior (mean,stderr) and posterior (mean,stderr,median) are report. Why @mcmcpostproc does not report them? If can? How dose?
Best Regard
Hardmann
Re: regime switching factor model
@MCMCPOSTPROC doesn't know what the prior was --- you do. So you can put the report together however you want. That's the reason @MCMCPOSTPROC doesn't do any output itself, since whatever it does will probably not be exactly what is wanted.hardmann wrote:Dear Tom:
In kimnp247, same model is estimated with Gibbs sampling. Its result are only,reported the mean, stdErr. For most bayesian estimation, including Kim & Nelson's book and paper, both prior (mean,stderr) and posterior (mean,stderr,median) are report. Why @mcmcpostproc does not report them? If can? How dose?
Re: Dynamics Factor with regime switching model
but how can I get posterior (mean,stderr,median)?
Re: Dynamics Factor with regime switching model
SSTATS has a FRACTILES option so you can relatively easily adjust MCMCPOSTPROC to compute the median as well.
Re: Dynamic Factor Model with Regime Switching
Dear Tom:
I want to simulate dynamic factor with regime switching model. As to me, these codes is too complicated to understand and modify.
Now I plan to use codes of kimnp126 with slighter modification for my data . I have encounted some questions. Please help me.
in kimnp126,
Question 1: K&N use monthly data, we use quarterly data, apart side cal(q), what need to modify?
Question 2: Question 1: forth variate, empgrow with rather AR(4) than AR(2) process, If it is also AR(2), its code should be: gamma(4)=%fill(1,1,0.2). Need to modify the other specification?
Question 3: could we modify numer of variates? If I have 3 varitates, size of the vector of beta, gamma,psi, spos should change from 4 to 3, and size of metric of state A,f,c, sw should change accordingly. Also,The start and end time is also changed accordingly.
dec vect[integer] spos(3)
compute spos=||4,6,8||
Need to modify the other specification?
Thanks
Hardmann
I want to simulate dynamic factor with regime switching model. As to me, these codes is too complicated to understand and modify.
Now I plan to use codes of kimnp126 with slighter modification for my data . I have encounted some questions. Please help me.
in kimnp126,
Question 1: K&N use monthly data, we use quarterly data, apart side cal(q), what need to modify?
Question 2: Question 1: forth variate, empgrow with rather AR(4) than AR(2) process, If it is also AR(2), its code should be: gamma(4)=%fill(1,1,0.2). Need to modify the other specification?
Question 3: could we modify numer of variates? If I have 3 varitates, size of the vector of beta, gamma,psi, spos should change from 4 to 3, and size of metric of state A,f,c, sw should change accordingly. Also,The start and end time is also changed accordingly.
dec vect[integer] spos(3)
compute spos=||4,6,8||
Need to modify the other specification?
Thanks
Hardmann
Re: Dynamic Factor Model with Regime Switching
Nothing. There's nothing about the seasonality that enters the model.hardmann wrote:Dear Tom:
I want to simulate dynamic factor with regime switching model. As to me, these codes is too complicated to understand and modify.
Now I plan to use codes of kimnp126 with slighter modification for my data . I have encounted some questions. Please help me.
in kimnp126,
Question 1: K&N use monthly data, we use quarterly data, apart side cal(q), what need to modify?
The gamma's are the loadings from the current and lagged cycle to the series. That's entirely separate from the AR for the noise term, which are handled by the psi vectors. The existing program does AR(2) noises for all variables. What it does differently for employment is to use current and three lags (thus 4 terms) on the cycle, while all other variables are just current. If you want all variables to just use current cycle, then all would have %fill(1,...) in the settings for gamma.hardmann wrote: Question 2: Question 1: forth variate, empgrow with rather AR(4) than AR(2) process, If it is also AR(2), its code should be: gamma(4)=%fill(1,1,0.2). Need to modify the other specification?
beta, gamma, sigma, psi, spos all need to have dimensions equal to the number of variables. sw needs to be dimensioned one greater than the number of variables (one for each noise term, one for the cycle). The constructors for A, F and C all need to be adjusted to add on three rather than four of the f2's or ar2's.hardmann wrote: Question 3: could we modify numer of variates? If I have 3 varitates, size of the vector of beta, gamma,psi, spos should change from 4 to 3, and size of metric of state A,f,c, sw should change accordingly. Also,The start and end time is also changed accordingly.
dec vect[integer] spos(3)
compute spos=||4,6,8||
Need to modify the other specification?
Re: Dynamic Factor Model with Regime Switching
Dear Tom:
my questions continue for next step according you advice.
question 2:
If all of 4 variables use current cycle, then all would have %fill(1,...) in the settings for gamma. I just modify this one, the filter probability of hold similiar to origin setting, however, the coincident indicator is reverse from upwards to downwards.
If all of 4 varibles use current on the cycle, some metric should be sparse, could some row and cols could remove. If so , A metric should be;
dec rect ar2(2,2)
ewise ar2(i,j)=(i==j+1)
compute a=ar~\ar2~\ar2~\ar2~\ar2
F metric should be:
dec rect f2(2,1)
compute f2=%unitv(2,1)
compute f=f2~\f2~\f2~\f2~\f2
C metric should be:
compute c=%zeros(2,4)~~(f2~\f2~\f2~\f2)
Is it right? the question still holds.
Please Tom help me.
question3: I use three varibles and current cycle, result is similar to that four varibles and current cycle. The question still holds.
Hardmann
my questions continue for next step according you advice.
question 2:
If all of 4 variables use current cycle, then all would have %fill(1,...) in the settings for gamma. I just modify this one, the filter probability of hold similiar to origin setting, however, the coincident indicator is reverse from upwards to downwards.
If all of 4 varibles use current on the cycle, some metric should be sparse, could some row and cols could remove. If so , A metric should be;
dec rect ar2(2,2)
ewise ar2(i,j)=(i==j+1)
compute a=ar~\ar2~\ar2~\ar2~\ar2
F metric should be:
dec rect f2(2,1)
compute f2=%unitv(2,1)
compute f=f2~\f2~\f2~\f2~\f2
C metric should be:
compute c=%zeros(2,4)~~(f2~\f2~\f2~\f2)
Is it right? the question still holds.
Please Tom help me.
question3: I use three varibles and current cycle, result is similar to that four varibles and current cycle. The question still holds.
Hardmann