Page 1 of 1

FOMC Dates

Posted: Tue Nov 17, 2015 7:05 pm
by svannorden
I'm trying to reproduce a data transformation used in Romer and Romer(2004) "A New Measure of Monetary Shocks: Derivation and Implications" American Economic Review, 94(4), p. 1055-

Their data set is downloadable from http://eml.berkeley.edu//~dromer/#data in .xlsx format. They start with a data set that has one observation for every FOMC meeting and so are irregularly spaced. After some initial transformations, they convert this into a monthly data series as follows:
"We assign each observation to the month in which the corresponding FOMC meeting occurred. If there are two meetings in a month, we sum the observations. If there are no meetings in a month, we record the observation as zero for that month."
How can I get RATS to read a series of irregularly-spaced data, and then convert it to monthly frequency using the rules that they specify? (Their file contains the FOMC meeting dates. )

Re: FOMC Dates

Posted: Wed Nov 18, 2015 11:40 am
by TomDoan
I'm not sure this is averaging what they're talking about, but it shows how you can map between the two data sets using the value of MTGDATE. If you're supposed to be turning "meeting" based data into monthly data, then you would add in values based upon (I) rather than (ENTRY) subscripts.

Code: Select all

OPEN DATA "C:\TEMP\RomerandRomerDataAppendix.xls"
CALENDAR(M) 1966:1
DATA(FORMAT=XLS,ORG=COLUMNS,SHEET="DATA BY MONTH") 1966:01 1996:12 RESID DFF DTARG RESIDF PCIPNSA PCWCP $
 PCPPINSA PCCPINSA PCPCEGSA LNIPNSA LNPPINSA LNWCP SUMSHCK FF SUMDTARG SUMSHCKF
*
DATA(FORMAT=XLS,ORG=COLUMNS,SHEET="DATA BY MEETING") 1 272 MTGDATE DTARG OLDTARG GRADM GRAD0 GRAD1 GRAD2 IGRDM IGRD0 IGRD1 IGRD2 $
 GRAYM GRAY0 GRAY1 GRAY2 IGRYM IGRY0 IGRY1 IGRY2 GRAU0 RESID DFFMTG RESIDF
*
dec series[int] mtgyear mtgmo mtgday
*
gset mtgyear = %mod(fix(mtgdate),100)
gset mtgday  = %mod(fix(mtgdate)/100,100)
gset mtgmo   = fix(mtgdate)/10000
*
clear(zeros) count m_pcipnsa m_pcwcp
do i=1,272
   compute entry=mtgyear(i):mtgmo(i)
   compute count(entry)+=1
   compute m_pcipnsa(entry)+=pcipnsa(entry)
   compute m_pcwcp(entry)+=pcwcp(entry)
end do i
set m_pcipnsa = %if(count==0,0.0,m_pcipnsa/count)
set m_pcwcp   = %if(count==0,0.0,m_pcwcp/count)

Re: FOMC Dates

Posted: Thu Nov 19, 2015 7:34 am
by svannorden
Many thanks, Tom! I always enjoy learning by studying your code.

So in this example, you're using GSET instead of SET only because you're using a series of INTEGER rather than a conventional series)?

Re: FOMC Dates

Posted: Thu Nov 19, 2015 8:56 am
by TomDoan
svannorden wrote:Many thanks, Tom! I always enjoy learning by studying your code.

So in this example, you're using GSET instead of SET only because you're using a series of INTEGER rather than a conventional series)?
Correct. SET is only for SERIES[REAL]. GSET can be used for any other type of SERIES, but the specific target type has to be declared.