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
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
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.
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
All links will be open in a new window
A description of the Hodrick Prescott filter at wikipedia. (HTML)
This java file 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.