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.

Programming Problems with Disaggreate

Unread postby hardmann » Sat Nov 14, 2020 12:55 pm

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 283 times
US_mgdp_2019.xls
US data
(68 KiB) Downloaded 289 times
hardmann
 
Posts: 159
Joined: Sat Feb 26, 2011 10:49 pm

Re: Programming Problems with Disaggreate

Unread postby hardmann » Tue Nov 17, 2020 9:08 am

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: 159
Joined: Sat Feb 26, 2011 10:49 pm

Re: Programming Problems with Disaggreate

Unread postby hardmann » Wed Nov 18, 2020 9:03 am

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
hardmann
 
Posts: 159
Joined: Sat Feb 26, 2011 10:49 pm

Re: Programming Problems with Disaggreate

Unread postby TomDoan » Wed Nov 18, 2020 3:29 pm

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.
TomDoan
 
Posts: 7236
Joined: Wed Nov 01, 2006 5:36 pm

Re: Programming Problems with Disaggreate

Unread postby hardmann » Thu Nov 19, 2020 11:16 am

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
hardmann
 
Posts: 159
Joined: Sat Feb 26, 2011 10:49 pm

Re: Programming Problems with Disaggreate

Unread postby TomDoan » Thu Nov 19, 2020 3:03 pm

This is strictly for guess values for the states. A crude distribution is fine for that.
TomDoan
 
Posts: 7236
Joined: Wed Nov 01, 2006 5:36 pm

Re: Programming Problems with Disaggreate

Unread postby hardmann » Mon Nov 23, 2020 6:25 am

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.
hardmann
 
Posts: 159
Joined: Sat Feb 26, 2011 10:49 pm

Re: Programming Problems with Disaggreate

Unread postby TomDoan » Mon Nov 23, 2020 10:45 am

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.
TomDoan
 
Posts: 7236
Joined: Wed Nov 01, 2006 5:36 pm


Return to Help With Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron