Filtro de Hodrick-Prescott no Excel

Um pouco fora da minha área certamente mas estou sempre pronto a apreciar boa programação e facilidade de uso. Se você precisa tirar a tendência de uma série com o filtro HP e quer a facilidade do Excel, ou quer usar em um ambiente de trabalho onde os programas são controlados, fica a dica do site abaixo. Ele explica onde baixar o add-in e como utilizar. Testado e aprovado.

There is a how to use PDF, short, says you give it a range of cells and a number (a constant). The long version: Select a range of cells for your results, type =HP( , select the range of cells containing the data to be filtered, type in a comma, type in the constant, and close the parentheses. But don’t hit ENTER.

Instead, hold down CTRL and SHIFT and then press ENTER. That’s it. Then you can make a graph or whatever, from the results.

Holding down CTRL and SHIFT while you press ENTER is standard Excel stuff. They call it “array formulas” which sounds pretty complicated… but all you have to do is hold down CTRL and SHIFT while pressing ENTER. How complicated is that?

None of that works, though, if you don’t have the Hodrick Prescott filter installed. No problem. Among the search results is a link to Kurt Annen’s HP-Filter Excel Add-In at IDEAS. There are three separate files you can download:

1. an XLA file, an Excel add-in which adds the HP( ) function to the built-in Excel functions.

2. the Visual BASIC source code for the HP( ) function.

3. an example.

For most people the simple thing would be to install the add-in. (The PDF linked above tells how.) For me, the simple thing was to copy the Visual BASIC source code and paste it into a code module. That way I got to look the code over a bit. It looks like a very complicated (arithmetically) version of a “moving average” calculation, or something comparable. That’s a crude description; I didn’t work through all the arithmetic. But the result you get from the HP filter serves the same sort of purpose as the result you get from the moving average calc.

Anyway, after it’s installed one way or the other, it’s as easy to use as =SUM( ) or any other Excel function. I expect to explore it, and to use it.

What number do you use for the constant?… for the “Lambda” as they call it?

Rule of thumb is:

Lambda = 100*(number of periods in a year)^2

There is additional research that suggests using a power of 4 instead of 2. See Ravn and Uhlig (2002). … 1-375.html

via The New Arthurian Economics: De-Trending.


3 comentários sobre “Filtro de Hodrick-Prescott no Excel

Deixe uma resposta

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do

Você está comentando utilizando sua conta Sair / Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair / Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair / Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair / Alterar )

Conectando a %s