Page 1 of 1

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

PostPosted: Thu Aug 02, 2012 2:08 pm
by AGM
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.

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

PostPosted: Tue Aug 07, 2012 9:12 am
by kyri82
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.

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

PostPosted: Thu Aug 09, 2012 12:38 pm
by AGM
Hi,

thank you very much for your help!

You saved my life:)

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

PostPosted: Thu Aug 09, 2012 2:47 pm
by kyri82
No problem! :)
Good luck!