{smcl}
{* 23jun2006}{...}
{hline}
help for {hi:hprescott}
{hline}
{title:Apply Hodrick-Prescott filter to time series}
{p 8 17}{cmd:hprescott}
{it:varlist}
[{cmd:if} {it:exp}]
[{cmd:in} {it:range}]
{cmd:,} {cmdab:stub(}{it:newvar}{cmd:)}
[
{cmdab:s:mooth(}{it:#}{cmd:)}
]
{p 4 4}{cmd:hprescott} is for use with time-series data. You must {cmd:tsset} your data before using {cmd:hprescott}; see help {cmd:tsset}. {cmd:hprescott} supports the {cmd:by} prefix, which may be used to operate on each time series
in a panel.
{p 4 4}{cmd:varlist} may contain time-series operators; see help {cmd:varlist}.
{title:Description}
{p 4 4}{cmd:hprescott} applies the Hodrick-Prescott (1997) filter to one or more time series in {it:varlist} which must be under the aegis of {cmd:tsset}. If a
panel calendar is in effect, the filter can be applied if a single panel is specified using {cmd:if} or {cmd:in} qualifiers, or with the {cmd: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 {cmd:stub()} option. The smoothed variables are identified by "_sm" in their names.
{cmd:hprescott} does not allow gaps within the observations of a time series.{p_end}
{title:Options}
{p 4 8}{cmd:stub(}{it:abbrev}{cmd:)}, which must be provided, specifies the "stub" from which new variable names will be created. Variables created by {cmd:stub} must be new variables. If the {it:varlist} contains time-series
operators, the dots in their names are replaced by underscores so that the resulting new variables' names are legal. {p_end}
{p 4 8}{cmd:smooth(}{it:#}{cmd:)} 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 {cmd:tsset}, the default smoothing parameter of 1600 will be applied. Specification of the {cmd:smooth} option will override default behavior.{p_end}
{title:Examples}
{p 4 8}{stata "webuse lutkepohl, clear" :. webuse lutkepohl, clear}{p_end}
{p 4 8}{stata "hprescott investment, stub(HP)" :. hprescott investment, stub(HP)}{p_end}
{p 4 8}{stata "hprescott D.investment D.income D.consumption if tin(1970q1,1979q4), stub(HD)" :. hprescott D.investment D.income D.consumption if tin(1970q1,1979q4), stub(HD)}
{p}Application in a panel:{p_end}
{p 4 8}{stata "webuse grunfeld, clear" :. webuse grunfeld, clear}{p_end}
{p 4 8}{stata "by company: hprescott invest, stub(hp)" :. by company: hprescott invest, stub(hp)}{p_end}
{p 4 8}{stata "egen double hpsm = rowtotal(hp_invest_sm_*)" :. egen double hpsm = rowtotal(hp_invest_sm_*)}{p_end}
{p 4 8}{stata "drop hp_invest_sm_*" :. drop hp_invest_sm_*}{p_end}
{p 4 8}{stata "egen double hpres = rowtotal(hp_invest_*)" :. egen double hpres = rowtotal(hp_invest_*)}{p_end}
{p 4 8}{stata "drop hp_invest_*" :. drop hp_invest_*}{p_end}
{title:Author}
{p 4 4}Christopher F. Baum, Boston College, USA{break}
baum@bc.edu
{title:References}
{p}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.{p_end}
{p}Kowal, Pawel (2005). MATLAB implementation of commonly used filters,"
http://ideas.repec.org/c/wpa/wuwppr/0507001.html{p_end}
{p}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.{p_end}
{title:Acknowledgements}
{p 4 4}The Mata code of this routine was translated from MATLAB code made available by Pawel Kowal (2005).
{title:Also see}
{p 4 13}On-line: {help bking} (if installed), {help tsset}