Skip to Main Content Skip to Search
Product Documentation

hpfilter - Hodrick-Prescott filter for trend and cyclical components

Syntax

hpfilter(S)
hpfilter(S,smoothing)
T = hpfilter(...)
[T,C] = hpfilter(...)

Description

Examples

Plot the cyclical component of the U.S. post-WWII seasonally-adjusted real GNP:

load Data_GNP
gnpdate = dates;
realgnp = Dataset.GNPR;
[T,C] = hpfilter(realgnp);
Warning: Missing or empty Smoothing parameter set to 1600.
plot(gnpdate,C)

Algorithms

The Hodrick-Prescott filter separates a time series yt into a trend component Tt and a cyclical component Ct such that yt = Tt + Ct. It is equivalent to a cubic spline smoother, with the smoothed portion in Tt.

The objective function for the filter has the form

where m is the number of samples and λ is the smoothing parameter. The programming problem is to minimize the objective over all T1, ..., Tm. The first sum minimizes the difference between the time series and its trend component (which is its cyclical component). The second sum minimizes the second-order difference of the trend component (which is analogous to minimization of the second derivative of the trend component).

References

[1] Hodrick, Robert J, and Edward C. Prescott. "Postwar U.S. Business Cycles: An Empirical Investigation." Journal of Money, Credit, and Banking. Vol. 29, No. 1, February 1997, pp. 1–16.

  


Free Interactive Computational Finance CD

View demos and recorded presentations led by industry experts.

Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS