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

Title

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

Syntax

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

options Description ------------------------------------------------------------------------- window(#) window over which local minima and maxima are computed; default is window(2) phase(#) minimum phase length; default is phase(2) cycle(#) minimum cycle length; default is cycle(5) ------------------------------------------------------------------------- by is allowed; see [D] by.

Description

sbbq generates a new variable "varname_point". Observation j of the new variable equals 1 if varname[j] is a peak, -1 if varname[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 p quarters long, and complete cycles are at least c quarters 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 j for which varname[j - #], ..., varname[j - 1] < varname[j] > varname[j + 1], ..., varname[j + #].

A candidate trough is an observation k for which varname[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.

Remarks

In 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")

Author

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

References

Bry, 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: 36581.

Acknowledgement

The 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