one-sided-HP-filter in stoch_simul - how to do that?

Hi,

how can I change the dynare code to apply the one-sided HP filter in the stoch_simul command?

I have a file defining the function one-sided-HP-filter. Among the dynare files, I found a file called sample_hp_filter, so I thought that it is enough if I rename my file and function and remove the original Dynare file. But it did not work.

Where can I found the code that can be changed in a way that a one-sided HP filter is computed?

I would be very thankful for your help.
Alma

Ps By the way, does it make a huge difference for the simulated data if we apply the one-sided or double-sided filter? In the end, we always come back to the ss, so perhaps this difference is not so important.

I am not sure how you can ask dynare to do that automatically, but you can do it manually. Each time dynare simulates the model, it saves all the simulated variables in a matrix called: oo_.endo_simul. This matrix is of size J-by-N, where J is the number of variables and N is the number of periods you asked to simulate (maybe the raws and columns are inversed, dont remember now but you can easily verify). Check the manual.

Then, what you can do is to save all your variables in a matrix, e.g:
A = oo_.endo_simul ;

and then you can apply whichever filter you want and derive whatever statistics you want. In that case make sure that you do not take into account some of the initial observations of the simulation, in computing statistics dynare drops by default 100, but you can drop as many as you wish with the option drop (again, see the Manual).

Hope that helps.

K.

Hi,

thank you very much for your help!

You saved my life:)

No problem! :slight_smile:
Good luck!