image thumbnail

Hodrick-Prescott Filter

version (2.04 KB) by Wilmer Henao
Finds the Hodrick-Prescott filter of a series.


Updated 18 Sep 2003

View License

This m-file finds the Hodrick-Prescott filtered series of any trendy time series; H-P is widely known in econometrics and can be used to analyse the trends and volatility of the series.

This version uses sparse matrices, this approach increases speed and performance and allows working with several time series simultaneously. The option 'makeplot' plots every time series introduced against its filtered counterpart and the output desvabs gives a "measure" of the volatility.

Download and type Help hpfilter for more details

Inspired in hpfilter by Ivailo Izvorski and Gauss code by Ken Matheny

Cite As

Wilmer Henao (2022). Hodrick-Prescott Filter (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: Analyze FEX download data

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!