As threatened in a recent message, a working version of the
Hodrick-Prescott filter for time series data is now available for
Stata. The existing 'hpfilter' routine (over 10 years old!) from STB is
problematic, with its failings a common topic on Statalist. The new
routine is a direct translation from Prescott's original FORTRAN
routine, and has been validated against that routine. It has been
modified to work with Stata variables rather than the Stata matrix
language, so it is not constrained in the length of the time series to
be filtered. The Stata implementation allows the filtering of a varlist
of series, the use of time series operators, and application to a
single unit of a panel. The 'hprescott' routine is available from SSC
via ssc install hprescott.
My thanks to Massimo Giovannini for assistance validating the routine.