The Hodrick Prescott filter (HP filter), introduced by Hodrick and Prescott (1980), is a flexible detrending method that

is widely used in empirical macro research. Let's suppose
that the original series _{} is composed of a trend component _{} and a cyclical component
_{}

_{}

The HP-Filter isolates the cycle component by following minimization problem.

_{}

The first term is a measure of the fitness of the time
series while the second term is a measure of the smoothness. There
is a conflict between "goodness of fit" and "smoothness".
To keep track of this problem there is a "trade-off"-parameter
_{}.Note that _{} is 0, the trend component
becomes equivalent to the original series while _{} diverges to infinity, the trend
component approaches a linear trend.

As you can see the HP filter acts to remove a trend from the data by solving a least square problem. In matrix notation we get

_{}

with _{}, _{} and

_{}

It can be shown that the solution of the minimization
problem is be given by _{} where _{} is the identity matrix with dimension T.

The height of the value _{} depends on the frequency of the
data. In the literature the following values are suggested.

100 |
yearly data |

1600 |
quarterly data |

14400 |
monthly data |

**[notes]**

The solution of the HP-filter must satisfies

_{}

The computation could be done by a
native Gauss algorithm. Unfortunately this method is not very efficient
especially if you want detrend a lot of data points. Note, that the
computational complexity of Gaussian elimination is _{}. A precise look at the matrix _{} shows
that this matrix has got a pentadiagonal structure. If we use this
property, we can accelerate the calculations strongly.

In the HP-filter Add-In I used an algorithm which is
described in Späth, Helmuth "*Numerik: Eine Einführung für
Mathematiker und Informatiker*". Vieweg-Verlag
Braunschweig/Wiesbaden (1994)

**[related links]**

All links will be open in a new window

wikipedia A description of the Hodrick Prescott filter at wikipedia. (HTML)

Hodrick Prescott reference, by Hyeongwoo Kim. A brief introduction. (PDF)

Hodrick Prescott Filter, by Yossi Yakhin. A brief introduction. (PDF)

Links to other sites from these pages are for information only and Kurt Annen accepts no responsibility or liability for access to, or the material on, any site which is linked from or to this site.

screenshot of hp-filter add-in

**[download]**

for downloading click on the filename

File: hpfilter.zipFilesize: 131 kb |

The Hodrick Prescott Filter Add-In was written by
Kurt Annen. This program is freeware. But I would highly appreciate
if you could give me credit for my work by providing me with information
about possible open positions as an economist. My focus as an economist
is on econometrics and dynamic macroeconomics. If you like the program,
please send me an email or donate it.

[hodrick prescott excel add-in]

©
2005 Kurt Annen