Products & Services Solutions Academia Support User Community Company

Learn more about Econometrics Toolbox   

hpfilter - Hodrick-Prescott filter

Syntax

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

Description

Remarks

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).

Example

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

load gnp
gnpdate = gnp(:,1);
realgnp = gnp(:,3);
[T,C] = hpfilter(realgnp);
Warning: Missing or empty Smoothing parameter set to 1600.
plot(gnpdate,C)

Reference

[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-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS