a question on disaggregate

For questions and discussion related to reading in and working with data.
hardmann
Posts: 252
Joined: Sat Feb 26, 2011 9:49 pm

a question on disaggregate

Unread post by hardmann »

Dear Tom:

I use @disaggregate function to distribute quarterly real gdp into monthly one. According to demo, I use option( model=loglin,maintain=average) to distribute log GDP, I also use the option ( model=linear,maintain=sum) to distribute unlogged GDP to verify. However, the two resulting monthly log GDP serires have same fluctuating pattern but different intercept. I consider the method two is correct, how about one? I guess the intercept can not be droped off?
Please Tom give me a help.

Code: Select all

open data us_rqGDP.rat
calendar(m) 1947:01
data(format=rats,compact=average) 1947:01 2019:10 gdp

set ly = log(gdp)
@disaggregate(tsmodel=rwar1,model=loglin,factor=3,$
maintain=average,print) ly / lmy_1
#
graph(head="US monthly distributed log real GDP",overlay=dot,key=upleft,klabels=||"Official","Estimated" ||) 2
# lmy_1
# ly

print / lmy_1 ly

@disaggregate(tsmodel=rwar1,model=linear,factor=3,$
maintain=average,print) gdp / rmgdp2
#
set lmy_2 = log(rmgdp2)

graph(head="US monthly distributed log real GDP",$
key=upleft,overlay=line,klabels=||"Loglin avg","Linear avg"||) 2
# lmy_1  / 1
# lmy_2  / 2

print / ly lmy_1 lmy_2

*** This Model is OK
@disaggregate(tsmodel=rwar1,model=linear,factor=3,$
maintain=sum,print) gdp / rmgdp3
#
set lmy_3 = log(rmgdp3)
print / gdp rmgdp3

graph(head="US monthly distributed log real GDP",$
key=upleft,klabels=||"Loglin avg","Linear avg","Linear sum"||) 3
# lmy_1  / 1
# lmy_2  / 2
# lmy_3  / 3
Best Regard
Hardmann
Attachments
us_rqGDP.RAT
(7.75 KiB) Downloaded 666 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: a question on disaggregate

Unread post by TomDoan »

MAINTAIN=SUM and MAINTAIN=AVERAGE will be different by a factor of 3. In logs that will be a difference of ln(3) which looks exactly like what you have. Because GDP is usually quoted at annual rates (12.0 for a quarter means at a rate that would produce 12.0 for a year), MAINTAIN=AVERAGE is the correct choice to give monthly numbers with the same behavior. MAINTAIN=SUM is used for values that aren't annualized (that is raw numbers for the reporting period).
hardmann
Posts: 252
Joined: Sat Feb 26, 2011 9:49 pm

Re: a question on disaggregate

Unread post by hardmann »

Dear Tom:

I am still confused. you maybe mean that monthly GDP is usually quoted at annual rates (12.0 for a month means at a rate that would produce 12.0 for a year). If I use raw data with option MAINTAIN=SUM,which is used for level values. How to settle with difference?
In other words, how to specify option to distribute the quarterly log GDP to get the monthly log GDP.
Hardmann
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: a question on disaggregate

Unread post by TomDoan »

By "raw data", I mean something like actual counts of items sold or manufactured (cars sold, tons of steel produced). Even those (at least in U.S. data) are generally quoted at annual rates. As far as I know, GDP is always quoted as an annual rate, so it you want to take quarterly to monthly, you want the monthly numbers to reflect the quarterly annual rate, which means you do MAINTAIN=AVERAGE.
hardmann
Posts: 252
Joined: Sat Feb 26, 2011 9:49 pm

Re: a question on disaggregate

Unread post by hardmann »

Dear Tom:

I may be disguide to my question. I present my question. We have quarterly real seasonally adjusted GDP, eg, US quarterly real GDP from St. loius Fed or philadelphia Fed. How to use @disaggregate procudure to get US monthly real GDP, I want to know option configration.

Best Regard
Hardmann
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: a question on disaggregate

Unread post by TomDoan »

Looking at your original program, you were applying MODEL=LOGLIN to the series in logs. That's wrong---MODEL=LOGLIN is applied to the levels. What you want is MODEL=LOGLIN,MAINTAIN=AVERAGE applied to the levels.
hardmann
Posts: 252
Joined: Sat Feb 26, 2011 9:49 pm

Re: a question on disaggregate

Unread post by hardmann »

Dear Tom:

I just want to get monthly real GDP.

Best regard
Hardmann
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: a question on disaggregate

Unread post by TomDoan »

I understand. What you want is MODEL=LOGLIN,MAINTAIN=AVERAGE applied to the levels, not applied to the logs. (The "log" part is done internally).
hardmann
Posts: 252
Joined: Sat Feb 26, 2011 9:49 pm

Re: a question on disaggregate

Unread post by hardmann »

Dear Tom:

I rearrange my code. I suddenly recall the intercept is correct. The quarterly real GDP is aggregation of monthly GDP. In simpleset case, the quarterly GDP is three times of monthly GDP. so log qGDP = log mGDP + Log(3). Thus, monthly log GDP serires have same fluctuating pattern with quarterly GDP, but different intercept. I had tried the option ( model=loglin,maintain=avergae) to level or log, the resulting monthly log GDP serires have same intercept with quarterly log GDP. I doubt there is mistake.

Please Tom give me a help.

Code: Select all

open data us_rqGDP.rat
calendar(m) 1947:01
data(format=rats,compact=average) 1947:01 2019:10 rqGDP

set ly = log(rqGDP)
graph(head="US quarterly real GDP",$
key=upleft,overlay=line,klabels=||"Level", "Log"||) 2
# rqgdp   
# ly     

*** This Model is baseline

@disaggregate(tsmodel=rwar1,model=linear,factor=3,$
maintain=sum,print) rqgdp / rmgdp
#

set lmy = log(rmgdp)
print / rqgdp rmgdp

graph(head="US monthly distributed GDP",$
key=upleft,klabels=||"Estimated", "Official"||) 2
# rmgdp    
# rqgdp      


graph(head="US monthly distributed log GDP",$
key=upleft,klabels=||"Monthly Distributed Log", "Quarterly Official Log"||) 2
# lmy   
# ly      

******** loglin Model with level

@disaggregate(tsmodel=rwar1,model=loglin,factor=3,$
maintain=average,print) rqgdp / rmgdp
#
set lmy_1 = log(rmgdp)
print / rqgdp rmgdp


graph(head="US monthly distributed log GDP",$
key=upleft,klabels=||"Monthly Distributed", "Quarterly Official"||) 2
# rmgdp    
# rqgdp      

graph(head="US monthly distributed log GDP",$
key=upleft,klabels=||"Monthly Distributed Log", "Quarterly Official Log"||) 2
# lmy_1   
# ly      

******** loglin Model with log
@disaggregate(tsmodel=rwar1,model=loglin,factor=3,$
maintain=average,print) ly / lmy_2
#


graph(head="US monthly distributed log real GDP",$
key=upleft,klabels=||"Estimated", "Official"||) 2
# lmy_2     
# ly       


graph(head="US monthly distributed log real GDP",$
key=upleft,klabels=||"Officail","Linear sum","Loglin Level","Loglin log"||) 4
# ly
# lmy  
# lmy_1   
# lmy_2   
Attachments
us_rqGDP.RAT
(7.75 KiB) Downloaded 662 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: a question on disaggregate

Unread post by TomDoan »

It seems that your problem is that you don't understand what "annual rate" means. As reported, quarterly GDP is not the amount of production in a quarter; it is the amount that would be produced in a year at the rate observed in that quarter (that is, 4 times the amount produced in the quarter itself). GDP is a flow, that is, a rate of production, so it always has to be measured in production/per time period, and that "time period" has been chosen to be a year. Distributing the average maintains that definition; distributing the sum does not. So your "baseline" is wrong and produces a number which is 1/3 of what it should be. Take the log, and it's -ln 3 less than it should be, which is what you are getting.
hardmann
Posts: 252
Joined: Sat Feb 26, 2011 9:49 pm

Re: a question on disaggregate

Unread post by hardmann »

Thanks for your guidance! Based on your opinion, I have read some paper to know better about the conceptions and modified part of choices in the code.
To make sure, I want to show my modified code. Would you please give me some advice about whether the code now can disaggregate the quarterly data into monthly properly.
Thanks!

Code: Select all

@disaggregate(tsmodel=rwar1,model=loglin,factor=3,$
maintain=average,print) rqgdp / rmgdp
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: a question on disaggregate

Unread post by TomDoan »

Yes.
Post Reply