Apply Butterworth square-wave highpass filter to time series
butterworth varlist [if exp] [in range] , freq(#) stub(abbrev) [ order(#) ]
You must tsset your data before using butterworth; see help tsset. If a panel calendar is in effect, the filter can be applied if a single panel is specified using if or in qualifiers, or with the by prefix.
varlist may contain time-series operators; see help varlist.
butterworth filters one or more time series using the Butterworth square-wave highpass filter described in Pollock (2000). The freq() argument specifies the minimum period of oscillation of the desired component of the time series, where 2 < freq < infinity. The order() of the filter may also be chosen; if not specified, it defaults to 2.
Options freq(#) specifies the minimum period of oscillation, in periods per cycle, to be retained in the time series, and must be given. It must be greater than 2 (the reciprocal of the Nyquist frequency). Higher-frequency components of the series will be returned in the filtered series.
stub(abbrev), which must be provided, specifies the "stub" from which new variable names will be created. Variables created by stub must be new variables. If the varlist contains time-series operators, the dots in their names are replaced by underscores so that the resulting new variables' names are legal.
order(#) specifies the order of the filter. If not specified, it defaults to 2.
Examples
. webuse lutkepohl,clear
. butterworth investment, freq(6) phi stub(F)
. butterworth investment income consumption, freq(12) stub(filt)
. butterworth D.investment, freq(4) order(3) stub(fl)
. use http://fmwww.bc.edu/ec-p/data/hayashi/sheston91.dta,clear
. drop if country>4
. tsset
. by country: butterworth rgdppc, freq(3) stub(SBY)
Authors
Christopher F. Baum, Boston College, USA baum@bc.edu
Martha Lopez, Boston College, USA lopezmo@bc.edu
References
D.S.G. Pollock, Trend estimation and de-trending via rational square-wave filters, Journal of Econometrics, 2000, 99, 317-334. Pawel Kowal (2005). MATLAB implementation of commonly used filters, http://ideas.repec.org/c/wpa/wuwppr/0507001.html
Acknowledgements
The Mata code of this routine was translated from MATLAB code made available by Pawel Kowal (2005).
Also see
On-line: hprescott (if installed), bking (if installed), cfitzrw (if installed), tsset