help sbbq-------------------------------------------------------------------------------

Title

sbbq-- Identify turning points in time series using the BBQ algorithm (Harding and Pagan, 2002)

Syntax

sbbq[varname] [if] [in] [,options]

optionsDescription -------------------------------------------------------------------------window(#)window over which local minima and maxima are computed; default iswindow(2)phase(#)minimum phase length; default isphase(2)cycle(#)minimum cycle length; default iscycle(5)-------------------------------------------------------------------------byis allowed; see[D] by.

Description

sbbqgenerates a new variable "varname_point". Observationjof the new variable equals 1 ifvarname[j] is a peak, -1 ifvarname[j] is a trough, and 0 otherwise.The algorithm identifies potential turning points as the local minima and maxima in the series. Candidate points must then satisfy two conditions: phases are at least

pquarters long, and complete cycles are at leastcquarters long.

Options

window(#)determines the number of observations # on both sides over which local minima and maxima are computed. Following Harding and Pagan (2002), the default is # = 2.A candidate peak is an observation

jfor whichvarname[j - #], ...,varname[j - 1] <varname[j] >varname[j + 1], ...,varname[j + #].A candidate trough is an observation

kfor whichvarname[k - #], ...,varname[k - 1] >varname[k] <varname[k + 1], ...,varname[k + #].

phase(#)imposes that every phase is at least # quarters long. In business cycle analysis, a phase is an expansion or a contraction. The default is # = 2.

cycle(#)imposes that every cycle is at least # quarters long. A cycle is the period between two peaks or two troughs. The default is # = 5.

RemarksIn their article, Harding and Pagan (2002) use the insights of Bry and Boschan (1971) to produce a business cycle dating algorithm based on quarterly data. BBQ stands for "Bry and Boschan Quarterly". Nothing prevents the use of this program with monthly data, provided that the appropriate options (window, phase, and cycle) are specified.

Example

. sysuse gnp96, clear

. generate lgnp = log(gnp96)

. sbbq lgnp, w(2) p(2)

. egen min_lgnp = min(lgnp)

. list date lgnp_point if inlist(lgnp_point,1,-1)

. tsline lgnp ||pcspike min_lgnp date lgnp date if lgnp_point==1 ||pcspike min_lgnp date lgnp date if lgnp_point==-1,lpattern(dash) leg(order(2 "Peaks" 3 "Troughs"))ti("Turning Points in US LogGNP")

AuthorPhilippe Bracke, London School of Economics, UK p.bracke@lse.ac.uk

ReferencesBry, G., and C. Boschan (1971). Cyclical Analysis of Time Series: Selected Procedures and Computer Programs, NBER, New York.

Engel, James (2005). Business Cycle Dating Programs, http://www.ncer.edu.au/data

Harding, D. and A. Pagan (2002). "Dissecting the cycle: A methodological investigation," Journal of Monetary Economics, 49: 365–81.

AcknowledgementThe GAUSS code made available by James Engel (2005) was essential in helping the author writing this program. John C. Bluedorn and Andrea Pescatori provided very useful suggestions to