Page 1 of 1

Programming Problems with Disaggreate

Posted: Sat Nov 14, 2020 11:55 am
by hardmann
Dear Tom:

I want to disaggreate and decompose the quarterly real GDP into monthly trend and cycle components .Since I want use US GDP in 2019, so I modified equation1 and equation5 in this post https://estima.com/forum/viewtopic.php?f=32&t=3430,
Image
Image
Keep equation2 and equation3 the same.
So I get,
Image
Image
Image
Image

And I met some problems, (a)I don’t know how to set the value of g appropriately.(b)It seems I set wrong initial guess which lead wrong xv and cv.(c)Some other errors that I didn't find in the code.

There is my code and data , it would be nice if you could help me.Thanks in advance for any help.

Re: Programming Problems with Disaggreate

Posted: Tue Nov 17, 2020 8:08 am
by hardmann
Dear Tom:

Our codes halt. These are response as follow:

The Error Occurred At Location 260, Line 3 of loop/block
## DLM5. Probable Model Error. Diffuse prior was not reduced to zero rank

Please Tom help me.
Hardmann

Re: Programming Problems with Disaggreate

Posted: Wed Nov 18, 2020 8:03 am
by hardmann
Dear Tom:

This problem reserves in my inner for one year. I really need your help to solve down this program. I am not sure whether this disaggregation and decomposition can be solved simultaneously in theory? If it does, I plea you help me to sure whether the bascial state space forms are correct for the first step? Secondly, I guess my codes are full with bugs, please you help me to debug. If such problem can not be solved under the condition, I will give it up temporarily.

Best regard
Hardmann

Re: Programming Problems with Disaggreate

Posted: Wed Nov 18, 2020 2:29 pm
by TomDoan
This is setting your initial values for the states. However, Y is NA for the first two months out of a quarter, so this won't work. You should have one Y for the measurement equation (which has only an observation every 3 periods) and another which has values for all three months in the quarter.

gset xstate0 startl endl = xv=%zeros(nx,1), $
lc=lcf,%do(i,1,nx,xv(i)=%if(lc(i)==0,0.0,log(y*lc(i)))),xv

I would also suggest that you rewrite the C FRML as a FUNCTION; it will be easier to read that using the (older) %DO functions.

Re: Programming Problems with Disaggreate

Posted: Thu Nov 19, 2020 10:16 am
by hardmann
TomDoan wrote: You should have one Y for the measurement equation (which has only an observation every 3 periods) and another which has values for all three months in the quarter.

gset xstate0 startl endl = xv=%zeros(nx,1), $
lc=lcf,%do(i,1,nx,xv(i)=%if(lc(i)==0,0.0,log(y*lc(i)))),xv
I don't get it.Why Y has values for all three months in the quarter?Do you mean missing values in the y that is used in log(y*lc(i))) should be artificially replace with some reasonable values?

With much appreciation,
H

Re: Programming Problems with Disaggreate

Posted: Thu Nov 19, 2020 2:03 pm
by TomDoan
This is strictly for guess values for the states. A crude distribution is fine for that.

Re: Programming Problems with Disaggreate

Posted: Mon Nov 23, 2020 5:25 am
by hardmann
Hi,Tom
another which has values for all three months in the quarter.
I know this might be simple,but it would be great if you could help me understand what's the use of the 'other' y in there.
TomDoan wrote: A crude distribution is fine for that.
I already understand that the initial guess there is not very appropriate,But how to set crude distribution for initial guess is still a problem for me,I'm not sure what kind of distribution is appropriate,It would be nice if you could give me some more specific hints.

Thank you for your patient reply.

Re: Programming Problems with Disaggreate

Posted: Mon Nov 23, 2020 9:45 am
by TomDoan
How about 1/3 of the quarterly value in each month? DATA will give you the quarterly value in each month if you take quarterly->monthly, so you would just need to multiple by 1/3 to get the equivalent distributed value.