Pre-filter vs. no pre-filter when data used in estimation is already HP filtered

Hello everyone,

I am estimating an NK model with 4 shocks and 2 observables. One of the variables are the log deviations of quarterly real GNP from its long run trend computed using the HP filter. I notice that the estimation results are pretty sensitive to the enabling of the pre-filter option. Could I get some insight into why this happens and if it can be an issue in the estimation?

Thanks in advance.

  1. You are not supposed to use the HP-filter when doing estimation based on a recursive state space system.
  2. If your results are that sensitive to the option there is most probably something wrong. Does the variable in the model that contains the observed data have steady state 0?

Thank you for your prompt response, Professor Pfeifer.

  1. I computed the long-run trend of the quarterly GDP series with the HP filter and used log deviations of GDP from the estimated trend as the observable for the variable in the model, which is log-linearized. Is this not correct?

  2. There are two observables in the model: inflation and log deviations of output. There is a big outlier in the latter in one period, and when I calculate the mean of the series, it is pretty close to zero (-0.0004). Is it possible that the pre-filter option might be removing the influence of such an outlier? If so, how?

  1. See

2. I would need to see the files.

Hello professor,

Thank you for your reply.

  1. I now understand why the two-sided HP filter should not be used. I read your guide and tried to specify an observation equation for output of the following form using log difference of output as the observable (y_obs):

y_obs = y-y(-1);

where y are the model variables (percentage deviations from steady state). However, this doesn’t work as the mode optimization routine does not converge (error: chol matrix must be positive definite). Could I get some feedback on this?

  1. Another option I considered was using the one-sided HP filter to compute log deviations from trend and use this as an observable, as specified in the guide. Is there a way I can implement this filter in Dynare?
  1. I would need to see the files
  2. Yes, Dynare has a Matlab file one_sided_hp_filter.m that you can use.

Hello professor,

I modified the observation equation by adding the average growth rate as the steady state growth rate of output as in Smets and Wouters. I have attached the files. The name of the parameter for the steady state growth rate is g_trend. I would apprecciate your feedback.

fsdat_simul.m (4.4 KB) nk_pr.mod (2.7 KB)

  1. When using prefilter, everything will be mean 0, so the observation equation is wrong.
  2. You are not handling parameter dependence correctly. Search the forum.

Hello professor.

The steady state parameters do not depend upon any of the parameters that I am estimating. Can there still be problems? Can you signal out any specific circularities in the calibration?

Thank you once again.

I did not check whether there is a problem for your particular parameters. But you should still never code it this way. Once you decide to estimate on of the parameters that enter other expressions, your results will be wrong.