IDEAS home Printed from

Matlab code for one-sided HP-filters


  • Alexander Meyer-Gohde

    (Humboldt University Berlin)

Programming Language



This file contains two different Matlab implementations of one-sided HP-filters. The first is the Kalman implementation laid out by Stock, J.H. and M.W. Watson (1999, p. 301) ["Forecasting inflation," Journal of Monetary Economics, vol. 44(2), pages 293-335, October.] for the optimal one-sided analogue to the standard HP-filter. The second is a serial implementation explained, for example, by Mehra, Y.P. (2004, p. 7) ["The Output Gap, Expected Future Inflation and Inflation Dynamics: Another Look," The B.E. Journal of Macroeconomics, Berkeley Electronic Press.] that runs the standard HP-filter serially through time using only the data available at a particular point in time for calculating a trend value for that point in time. As a byproduct, a fast sparse-matrix implementation of the standard HP-Filter is included.

Suggested Citation

  • Alexander Meyer-Gohde, 2010. "Matlab code for one-sided HP-filters," QM&RBC Codes 181, Quantitative Macroeconomics & Real Business Cycles.
  • Handle: RePEc:dge:qmrbcd:181

    Download full text from publisher

    File URL:
    File Function: program code
    Download Restriction: none


    Citations are extracted by the CitEc Project, subscribe to its RSS feed for this item.

    Cited by:

    1. Christopher E. Boehm, 2016. "Government Spending and Durable Goods," CESifo Working Paper Series 6244, CESifo.
    2. Valentin Jouvanceau, 2016. "The Portfolio Rebalancing Channel of Quantitative Easing," Working Papers 1625, Groupe d'Analyse et de Théorie Economique Lyon St-Étienne (GATE Lyon St-Étienne), Université de Lyon.
    3. Bertrand Achou & Hippolyte d'Albis & Eleni Iliopulos, 2021. "Real Estate and Rental Markets during Covid Times," Documents de recherche 21-02, Centre d'Études des Politiques Économiques (EPEE), Université d'Evry Val d'Essonne.
    4. Giri, Federico, 2018. "Does interbank market matter for business cycle fluctuation? An estimated DSGE model with financial frictions for the Euro area," Economic Modelling, Elsevier, vol. 75(C), pages 10-22.
    5. Go Kotera & Saisuke Sakai, 2017. "Complementarity between Merit Goods and Private Consumption: Evidence from estimated DSGE model for Japan," KIER Working Papers 978, Kyoto University, Institute of Economic Research.
    6. Rodríguez, Aldo, 2020. "Estimación Bayesiana de un Modelo de Economía Abierta con Sector Bancario," Dynare Working Papers 52, CEPREMAP.
    7. Helene Olsen & Harald Wieslander, 2020. "The Impact of Monetary Policy on Leading Variables for Financial Stability in Norway," Working Papers No 02/2020, Centre for Applied Macro- and Petroleum economics (CAMP), BI Norwegian Business School.

    More about this item




    Access and download statistics


    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:dge:qmrbcd:181. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    We have no bibliographic references for this item. You can help adding them by using this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Christian Zimmermann (email available below). General contact details of provider: .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.