-------------------------------------------------------------------------------
help for hprescott
-------------------------------------------------------------------------------

Apply Hodrick-Prescott filter to time series

hprescott varlist [if exp] [in range] , stub(newvar) [ smooth(#) ]

hprescott is for use with time-series data. You must tsset your data before using hprescott; see help tsset. hprescott supports the by prefix, which may be used to operate on each time series in a panel.

varlist may contain time-series operators; see help varlist.

Description

hprescott applies the Hodrick-Prescott (1997) filter to one or more time series in varlist which must be under the aegis of 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. The default smoothing weight of 1600 is applied; this was specified by H-P as appropriate for quarterly macroeconomic data. The filtered series and smoothed series are placed in new variables, specified with the stub() option. The smoothed variables are identified by "_sm" in their names. hprescott does not allow gaps within the observations of a time series.

Options

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. smooth(#) specifies the smoothing parameter to be applied. The default is 1600. Ravn and Uhlig (2002) have shown that the smoothing parameter should vary by the fourth power of the frequency observation ratios, so that for annual data a smoothing parameter of 6.25 is recommended, while for monthly data a smoothing parameter of 129,600 is recommended. If one of these data frequencies are evident in the data, the appropriate default parameter will be used. If other data frequencies are in use, or if the data frequency has not been set in tsset, the default smoothing parameter of 1600 will be applied. Specification of the smooth option will override default behavior.

Examples

. webuse lutkepohl, clear . hprescott investment, stub(HP)

. hprescott D.investment D.income D.consumption if tin(1970q1,1979q4), stub(HD)

Application in a panel:

. webuse grunfeld, clear

. by company: hprescott invest, stub(hp)

. egen double hpsm = rowtotal(hp_invest_sm_*)

. drop hp_invest_sm_*

. egen double hpres = rowtotal(hp_invest_*)

. drop hp_invest_*

Author

Christopher F. Baum, Boston College, USA baum@bc.edu

References

Hodrick, R. and Prescott, E. (1997). Post-war U.S. business cycles: An empirical investigation. Journal of Money, Credit and Banking, 29(1), 1-16.

Kowal, Pawel (2005). MATLAB implementation of commonly used filters," http://ideas.repec.org/c/wpa/wuwppr/0507001.html

Ravn, Morten O. and Harald Uhlig (2002). On adjusting the Hodrick-Prescott filter for the frequency of observations. Review of Economics and Statistics 84(2), 371-376.

Acknowledgements

The Mata code of this routine was translated from MATLAB code made available by Pawel Kowal (2005).

Also see

On-line: bking (if installed), tsset