### My most successful product

I believe my work speaks for itself. Browse my most successful project below and enjoy my **handmade work**.

It began in 2003 when I wrote my diploma thesis in monetary macroeconomics I came the first time in closer contact with a mathematical tool used in macroeconomics, especially in real business cycle theory, to remove the cyclical component of a time series from raw data. Immediately I understood the popularity of the filter among researchers. I am talking about the Hodrick Prescott filter, introduced by Hodrick and Prescott (1980).

During this time, like many others, I used a Matlab code to compute the Hodrick-Prescott filter. But there were two things that bothered me. First It seemed to me unfortunate that a non-free license of Matlab must be installed on the PC. 15 years ago, around the year 2014, Octave and R as an alternative were still at a fledgling stage and were hard to use. The most alluring reason was the fact that I wanted to evaluate the data directly within Excel. I’ve been hunting around the internet for an Excel Version and found what I was looking for. Unfortunately, the algorithm worked slow that I decided to write my own Excel Add-In. I studied the Hodrick-Prescott Filter and found a simple solution by taking full account on solving pentadiagonal linear systems. I used a fast algorithm to write a simple VBA Code. [web:reg] HP Filter Add-In was born. The Add-In has become increasingly popular amongst researcher, students and professionals since 2014.

In the last few years I‘ve been asked to program an one-sided Hodrick-Prescott Filter and I wrote an Add-In in C. The Excel Add-In has been extended by the one-sided HP-Filter.

Both Add-In can be downloaded for free.

I thank you for your trust in my Add-Ins.

Kurt Annen

### Hodrick-Prescott Filter (VBA)

Download “[web:reg] HP Filter” wr_hp_filter.zip – Downloaded 10033 times – 88 KB

### Hodrick-Prescott Filter V02 inc. one sided HP Filter (C)

Download “[web:reg] HP Filter V02” wr_hp_filter_v2.zip – Downloaded 3620 times – 133 KB

## The equation

Let’s suppose that the original time series (y_t)_{t=0}^T is composed of a trend component\tau_t and and a cyclical component c_t. That is, y_t = \tau_t + c_t The HP-Filter isolates the cycle component by following minimization problem \min_{\tau_1,\dots,\tau_T}\sum_{t=1}^{T} \left ( y_t-\tau_t\right )^2 +\lambda\sum_{t=2}^{T-1}\left [\left ( \tau_{t+1}-\tau_t \right )\left ( \tau_t-\tau_{t-1} \right ) \right ]^2 where \lambda is a positive smoothing parameter that penalizes variability in the trend. The unique solution to the minimization problem is \widehat{\tau}=\left ( I_T+\lambda F \right )^{-1}y where I_T is an T\times T identity matrix and F is the pentadiagonal T\times T matrix. F=\begin{pmatrix}1& -2& 1& & & & & & &\\ -2& 5& -4& 1& & & & & &\\ 1& -4& 6& -4& 1& & & & &\\ & 1& -4& 6& -4& 1& & &\\& & \ddots& \ddots& \ddots& \ddots& \ddots& & \\& & & 1& -4& 6& -4& 1& &\\ & & & & 1& -4& 6& -4& 1&\\ & & & & & 1& -4& 5& -2&\\ & & & & & & 1&-2& 1&\end{pmatrix}.

The value of \lambda depends on the frequency of the data. In the literature the following values are suggested.

100 |
yearly data |

1600 |
quarterly data |

14400 |
monthly data |