{smcl}
{* 19oct2004}{...}
{hline}
help for {hi:hprescott8}
{hline}

{title:Apply Hodrick-Prescott filter to time series}

{p 8 17}{cmd:hprescott8}
{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:hprescott8} is for use in Stata 8.2. Users of more recent versions of
Stata should use {cmd:hprescott}, which makes use of Mata.

{p 4 4}{cmd:hprescott8} is for use with time-series data. You must {cmd:tsset} your data before using {cmd:hprescott8}; see help {cmd:tsset}. {cmd:hprescott8} 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:hprescott8} 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 "_t" in their names.
{cmd:hprescott8} 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. {p_end}


{title:Examples}

{p 4 8}{stata "webuse lutkepohl, clear" :. webuse lutkepohl, clear}{p_end}
 
{p 4 8}{stata "hprescott8 investment, stub(HP)" :. hprescott8 investment, stub(HP)}{p_end}

{p 4 8}{stata "hprescott8 D.investment D.income D.consumption if tin(1970q1,1979q4), stub(H)" :. hprescott8 D.investment D.income D.consumption if tin(1970q1,1979q4), stub(H)}



{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}Edward C. Prescott, undated. "FORTRAN code for the Hodrick-Prescott filter," QM&RBC Codes 3, Quantitative Macroeconomics & Real Business Cycles at http://ideas.repec.org{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}This routine was translated from FORTRAN code written by Edward C. Prescott, available from http://ideas.repec.org/c/dge/qmrbcd/3.html
Thanks to Massimo Giovannini for assistance in validating its results.{p_end}
 

{title:Also see}

{p 4 13}On-line: {help bking} (if installed), {help tsset}


