Is it ok to use HP filtered data?


I have already log-linearized my model by hand.

So far I have estimated the model using HP detrended data on some variables (real GDP, consumption, goverment expenses, employment,…) but not for other (federal funds rate and inflation).

I’m not sure if this is the right way to do things. Is it better to proceed the way I’m doing things or is it better to use the data in levels and apply the prefilter option (would this option also remove the trend in real GDP and consumption?)?

Should I remove the trends linearly or with HP filter?

Anyone knows what is the best way to do this? I have seen some posts where people do not advise to use HP filters on the data.

I have in attachment the mode file, the data, the output results and a pdf file that explains the model

Joao (203 KB)


no, you should never use either HP filter, or band-pass filter, or whatever univariate, even multivariate prefiltering technique. Instead, you should look at your data and build your model with non-stationary technologies explaining permanent shifts in relative prices, or shifts in output volumes, etc.

Now listen carefully. These technologies will contain transitory and permanent parts. What is important here is that the permanent shocks of these technologies will explain significant portion of high frequency parts of spectral densities of the observed variables (and their correlations). How much, depends on the type of the economy, it will be much more significant for transitory and emerging economies.

For example, let’s assume that you have a model without these non-stationary technologies. Assume that you use HP filtered gaps as observables. This prefiltering will cut off low frequency spectra and you are left with high frequency gaps in which a significant portion is caused by permanent shocks which are not in the model. Your estimates will be biased.

My point is that permanent shocks explain both high frequency and low frequency parts of spectral densities. You cannot just cutoff some frequencies and then have a model withou tpermanent shocks.

Since these permanent shocks are not well identified in the data, we can employ the beauty of Bayesian framework and our economic brains. This is very exciting stuff and you learn a lot!

Ondra K.

I agree with the suggestion of pre-filtering the data as little as possible prior to estimation, where pre-filtering means things such as demeaning, using a linear or quadratic trend, or using an HP-filter. However, I disagree with the conclusion that one should model the stochastic behavior of the variables as being driven by permanent and transitory shocks, as this assumes - without testing - that there are unit roots in any data series that only permanent shocks are equipped to deal with.

Over the past years, several studies have successfully estimated DSGE models under the (milder) assumption of deterministic trends: to give an example, Smets and Wouters AER 2007 characterizes productivity as driven by trend-stationary shocks, without using unit roots. Ireland (RESTAT) shows that estimating two otherwise identical RBC models, the data favor a version of the model in which productivity is trend-stationary rather than unit-root.

I think that telling students that unit roots is the only way to go is a bit misleading. After all, macroeconomists have disagreed for decades about the importance and the role of unit roots. If you take log U.S. GDP for the last 100 years and fit a linear trend through it, it does a pretty good job, even in accounting for the recovery after the great depression.

Hi Ondra and iacovel,

Thanks for your answers, both your comments are very interesting and I will probably explore both venues.



I was reading your debate about filtering and is very interesting.
I have a related doubt:
RBC models incorporate growth assuming a linear TFP trend because as Iacovello explained a linear trend does a pretty good job to fit log US GDP for the last 100 years. Then…
why do RBC models filter the data with the HP filter instead of using a linear trend?
Using HP filtering while putting a linear trend in the model looks inconsistent, why not to evaluate the moments from the model with data filtered as the model suggests?