I was trying to replicate the variance decomposition in Smets and Wouters (2007), and could use some help with that.

Based on the results it seems that if hp_filter option is set, the HP filter is only used by Dynare for variance decomposition, but not for conditional variance decomposition. Is that correct?

As a consequence, with hp_filter option even for period 100 the two decompositions don’t look the same. But I was quite surprised how different they are - for example for GDP, productivity shock is attributed 47% without HP filter but only 20% with HP filter, and wage mark-ups get 6% vs 24%. It also seems that Figure 1 in Smets and Wouters (2007) is based on non-HP filtered decomposition; why would this be the preferred way to analyze the contribution of different shocks?

[code]VARIANCE DECOMPOSITION (in percent) (HP filter, lambda = 1600)
ea eb eg eI er ep ew
y 20.74 18.06 17.13 20.11 11.40 5.95 6.61

CONDITIONAL VARIANCE DECOMPOSITION (in percent)
Period 100:
ea eb eg eI er ep ew
y 47.10 2.15 3.32 4.09 2.55 16.15 24.65[/code]

There is a big literature on the difference introduced by different filters (Canova is one of the protagonists). Why would you use the HP-filter at all. The model variables are already stationary. There is no point in filtering. Hence, Figure 1 in Smets/Wouters uses the stationary unfiltered model variables. Note also that Smets/Wouters for their data use a first difference filter, not an HP-filter.

Thanks Johannes. What I had in mind was not to use HP filter for observables, but rather afterwards when the model is simulated. Like in the RBC literature, where to compare the standard deviations and correlations of model generated data and US economy data it is common to HP filter both. So I thought that variance decomposition would be also done using HP filtered series. Which paper would you recommend to read for an up to date view on how different filters affect business cycle facts?

My point was not for observables and is still valid: if you think there is a unit root (and Smets-Wouters do so), you should not use the HP-filter for detrending. You should compare the variance decomposition of first differences of the model variables with the one of the data. However, as you do not know the variance decomposition of the data, there is nothing to compare here. That’s why Smets/Wouters can just look at the decomposition of the stationary model variables. The other case is Schmitt-Grohe/Uribe (2012) What’s News in Business Cycles who decompose first differences.

A good starting point are Canova’s two 1998 JME pieces: Detrending and business cycle facts and Detrending and business cycle facts - A user’s guide

OK, got it. I guess the reason why I was confused is that Schmitt-Grohe & Uribe (2012) explicitly state when the decomposition is for growth rates, and they also do the decomposition for HP filtered log levels. Title for Figure 1 in SW(2007) only says GDP, not GDP growth rate. Thanks again!