Programming Problems with Disaggreate

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
hardmann
Posts: 252
Joined: Sat Feb 26, 2011 9:49 pm

Programming Problems with Disaggreate

Unread post 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.
Attachments
disaggregate+qgdp+into+mt&c+0.04.RPF
disaggregate qgdp into mt
(3.46 KiB) Downloaded 949 times
US_mgdp_2019.xls
US data
(68 KiB) Downloaded 948 times
hardmann
Posts: 252
Joined: Sat Feb 26, 2011 9:49 pm

Re: Programming Problems with Disaggreate

Unread post 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
hardmann
Posts: 252
Joined: Sat Feb 26, 2011 9:49 pm

Re: Programming Problems with Disaggreate

Unread post 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
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Programming Problems with Disaggreate

Unread post 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.
hardmann
Posts: 252
Joined: Sat Feb 26, 2011 9:49 pm

Re: Programming Problems with Disaggreate

Unread post 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
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Programming Problems with Disaggreate

Unread post by TomDoan »

This is strictly for guess values for the states. A crude distribution is fine for that.
hardmann
Posts: 252
Joined: Sat Feb 26, 2011 9:49 pm

Re: Programming Problems with Disaggreate

Unread post 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.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Programming Problems with Disaggreate

Unread post 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.
Post Reply