The Hodrick-Prescott (HP) filter is the optimal estimator of the trend component in a smooth trend model with signal-to-noise ratio parameter fixed at 1/1600. It gives the detrended observations, , for large samples and t not near the beginning or end of the series

where .

Bear in mind that if the smooth trend model was believed to be the true model there would be no reason to apply the HP filter. The filtered data of a smooth trend model contain nothing more than white noise. The belief here is clearly different.

We can easily show that the **gain** from the detrending filter is given by:

Note that the smaller the the more the filter concentrates on removing low frequencies.

Gain for HP filter

Suppose the series are integrated e.g. then

stationary for

Then the **autocovariance generating function** of the series is given by:

Hence if is a random walk the **spectrum** of the detrended series is given by

Spectrum of HP detrended random walk.

This spectrum has got a peak at which for signal-to-noise ratio fixed at 1/1600 corresponds to a period of about thirty. Thus applying the HP filter to a random walk generates detrended observations which have the characteristics of a business cycle for quarterly observations!

̄

——————————————————————————————————————————————

**An example**:

#Simulates random walk
x<- cumsum(rnorm(80))
# Plots Trend and Cyclical of HP - requires package mFilter
plot(hpfilter(x,type="lambda",freq=1600))

**Further Reading:**

*Harvey*, A. C. and Jaeger, A. (1993), *Detrending*, stylized facts and the business cycle. Journal of Applied Econometrics, 8: 231–247

### Like this:

Like Loading...

*Related*

You don’t happen to work as a quant in a hedgefund or IB do you? 🙂

For a given sampling frequency (monthly, quarterly, etc.) is there a functional relationship between lambda and omega-star, where omega-star is the peak frequency from, say, a periodogram? I’m new to spectral analysis. It would seem that if we new a monthly time series had a n-month cycle that lambda should be set to x(n).

Hi David and thanks for your message. The sample periodogram allows us to get statistical inference (i.e. estimates) for a time-series based on their frequency domain properties. It essentially captures the portion of the sample variance of the series that can be attributed to a continuum of frequencies (or the contribution made by various periodic components). Bear however in mind that regular cycles are quite rare (especially in economic time series) and hence what we look for is a tendency towards cyclical movements centred around particular frequencies.

Now ω* (omega-star) is an estimate of the λ_max/2π since the periodogram is the sample equivalent of 2πf(λ). Assume that the periodogram gives you peak frequency at ω*=1/n (note that for discrete time points ω* max =.5 – half cycles per observation – since we need at least two points to determine a cycle). That would suggest the existence of a cycle of period n (i.e. at λ_max = 2π/n). However as I have highlighted here some linear filters (such as the HP) can potentially create

spuriouscycles. Apply the HP on I(1) (quarterly) time series and what your see in your periodogram is the standard 7+ year business cycles.Thanks again and please do let me know whether I have answered your query.

I think you have omitted the main drawback of HP filter, which is that it gives volatile results on a rolling window

You are right Fred. Although HP is very efficient in the middle, it is much less efficient at the end – see for example Harvey and Delle Monache (JEDC, 2009). There is much bigger increase in MSE at the end of the series as compared with the middle.

But here I focused on one of the less known attributes of the filter. The Yule-Slutzky effect.

This is very helpful. Can you please suggest a reference (book, paper) that shows the mathematical details of the connection between omega-star and lambda?

Brockwell and Davis (2009 – yellow book, ch4, 10) and Shumway and Stoffer (2000, ch4) are two good references. Harvey (1993) is also good but it is less rigorous