UCM trend cycle decomposition

Discussion of State Space and Dynamic Stochastic General Equilibrium Models
mob7
Posts: 9
Joined: Tue May 03, 2011 9:40 am

UCM trend cycle decomposition

Unread post by mob7 »

Hi Tom,

I am trying to replicate some of the methods in the paper linked below, which uses an additional observable variable to better identify the cycle in an unobserved components model and also accounts for a markov switching drift term in the trend. I have started to deal with the first element first before addressing the markov switching. Based on a few replication examples I have got together the code attached and run it on the data file also attached. It seems like the model is cast correctly in state space form, but I must be doing something wrong in the dlm instructions as I get the error ## DLM2. No Observations Produce Valid Output. Check Data and Initial Values. Any thoughts, or is the code correct and I have some more fundamental problem with the model as specified?

https://www.ecb.europa.eu/pub/pdf/scpwp ... 754f5c16da
Attachments
uc_trend_cycle_aux.RPF
(2.13 KiB) Downloaded 870 times
trend_cycle_aux.txt
(3.91 KiB) Downloaded 839 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: UCM trend cycle decomposition

Unread post by TomDoan »

You have the c_uc1 as a RECT rather than a FRML[RECT] and a1 and a2 aren't defined yet when you create it.
mob7
Posts: 9
Joined: Tue May 03, 2011 9:40 am

Re: UCM trend cycle decomposition

Unread post by mob7 »

Thanks Tom. Is the first DLM instruction which calls on the parmset=small necessary? I don't understand why the final values for all parameters are not jointly determined? I included it following the replication file for Clarke's bi-variate model in Kim and Nelson.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: UCM trend cycle decomposition

Unread post by TomDoan »

It may not be necessary. It doesn't necessary hurt. The point (as you can read in the comments) is to get a better set of values for the GDP model before trying to do the full set simultaneously. The one thing that is not necessary is the CONDITION option. That's in the Kim-Nelson example because that's how they handled the unit root in the model. If you have the PRESAMPLE=ERGODIC, CONDITION isn't necessary.
mob7
Posts: 9
Joined: Tue May 03, 2011 9:40 am

Re: UCM trend cycle decomposition

Unread post by mob7 »

Thanks Tom. When considering the Markov-switching trend I am taking a slightly different approach to the authors in the paper linked in my OP and amending the replication file for Kim's representation of Lam's generalised Hamilton model (kimnp111.rpf). I am continuing to use an auxiliary observable in identifying the cycle. The C matrix that I have specified as a result of having the auxiliary information has a different dimension to that in the Kim and Nelson text and it leads to some difficulty in the Kim filter set up. I have made some amendments in the attached along the lines of what I had thought would be necessary, but no success in estimating thus far. Any suggestions would be appreciated. The specification I am aiming for is attached in the jpg.
Attachments
ucm_aux.jpg
ucm_aux.jpg (44.41 KiB) Viewed 10912 times
uc_trend_cycle_aux2.RPF
(5.83 KiB) Downloaded 890 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: UCM trend cycle decomposition

Unread post by TomDoan »

You can't use FRML's for the components for doing the Kim filter. Anything that depends upon free parameters (such as your C matrix) needs to be computed as part of the DLMStart function
mob7
Posts: 9
Joined: Tue May 03, 2011 9:40 am

Re: UCM trend cycle decomposition

Unread post by mob7 »

Thanks for your help Tom. So in this case, if I understand correctly, the issue is that the C and SV components need to be computed within the DLMStart function before the Kim filter is initialised as the remaining components with free parameters are already done so in the block with the start up code for each evaluation? I have amended along these lines but still have some dimensioning problems when it comes to calculating the prediction error (## MAT2. Matrices with Dimensions 1 x 1 and 2 x 1 Involved in %DOT Operation The Error Occurred At Location 263, Line 24 of KIMFILTER 34593176 Position 3752).
Attachments
uc_trend_cycle_aux2.RPF
(5.87 KiB) Downloaded 838 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: UCM trend cycle decomposition

Unread post by TomDoan »

%DOT is for vectors which would be appropriate when you have a single observable. You need a matrix multiply instead:

compute yerr=ctgdp(time)-(%dot(c_uc2(i,j),xwork(i,j))+mu_uc2(i))
Post Reply