Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: new jokes


From   baum <baum@bc.edu>
To   StataList <statalist@hsphsun2.harvard.edu>
Subject   st: new jokes
Date   Fri, 16 Aug 2002 14:05:59 -0400

Well, the new, improved tsspell is so handy, it will force me to retire my Harry Potter jokes about the older -spell- routine. Instead we can turn to Florida elections jokes (were that they were). Absent from the otherwise copious help in tsspell is an example of how a macroeconomist may detect recessions (using a crude form of the NBER's recession-dating methodology). Whatever your political leanings (or if you are merely an amused observer of these shenanigans from afar), tsspell makes it very easy indeed to perform these calculations:

use http://fmwww.bc.edu/ec-p/baum/realGDP,clear
tsset

g str3 party = "Rep" if tin(,1960q4) | tin(1969q1,1976q4) /*
*/ | tin(1981q1,1992q4) | tin(2001q1,)
replace party = "Dem" if party==""

* define a recession as two quarters' decline in real GDP
g sign = sign(D.realGDP)
tsspell sign
egen qtrs = max(_seq), by(_spell)
gen recession = (D.realGDP<0 & qtrs>=2)

list yq realGDP qtrs party if recession

* what were the longest expansions, and who was in charge
* when they ended?

gsort -qtrs
keep if _end & sign
list qtrs party yq in 1/5


If we had a multi-country panel data set of GDP figures for, say, the G7, the logic above would work just as well; as tsspell's help indicates, one would merely modify the egen to include the 'iis' variable.

Kit

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index