Extended_path to generate IRFs in stochastic context?


My model uses operators like max, min, abs, sign, <, >, <=, >=, ==, != which is discouraged in stoch_simul. I want to generate the IRFs of the model. In the manual, it is said that extended_path is not affected by this problem. But I could not find an example to see how IRF is generated using extended_path.

Is there a sample code to replace IRF generation via stoch_simul with IRF generation via extended_path? Note that I find the steady state of my model using a matlab file.


@stepan-a Is there a working example somewhere?


Any answer to this?

I tried replacing stoch_simul with extended_path in my model, but the steady state values returned by the matlab file are not reflected in the oo_.steady_state object (all values are 0) and then there is no time series generated in oo_.endo_simul probably because the steady state values are all 0.

The model runs fine with stoch_simul. What might be going wrong?

Secondly, to generate IRF, the values in oo_.exo_simul should be (stdev,0,0,…). But extended_path does not generate that by default. What should be done to change it so that it generates the IRF?


Examples are at https://git.dynare.org/Dynare/dynare/tree/master/tests/ep
An IRF in this context would be to define a given shock at time 0 and then compute the corresponding simulation.

Thank you Professor!

I am now able to generate a time series using extended_path just like the one generated using stoch_simul. Now, I want to use this time series to generate the IRF plots as stoch_simul does. Extended_path does not generate such IRF plots by default.

What should I do to generate these IRF plots? Is there a quick way to do that? I see that the values in the time series are not the same as the values in the IRF plots of stoch_simul.

You need to set up the requisite simulation exercise. Start at the steady state, end at the steady state and add a shock in the first period. Then you should be able to use rplot to graph the result, which is the perfect foresight version of an IRF, i.e. a one-time shock that was not anticipated.

Thank you! Please confirm that I have understood the steps correctly:

  1. I set DynareResults.steady_state equal to the steady state (which I have to add separately to extended_path as extended_path does not read steady state values from a matlab file by itself)

  2. Fix a T (=300) number of periods for which to run the simulation.

  3. Set DynareResults.exo_simul to the vector (sd, 0, 0, …, 0) of size T where sd is the standard deviation of the shock in the model.

  4. Run the simulation which is in extended_path.m and plot the simulated time series with rplot.

Secondly, I use hp_filter in stoch_simul to smooth the IRF. Is there a way to apply this filter on the time series generated by extended_path?

Also, when running extended_path with model(use_dll); instead of model; , all the values in the time series become NaNs, whereas model; generates the correct values. What might be going wrong?

  1. Yes, that sounds sensible.
  2. Why do you filter IRFs? That is very unusual.
  3. Which Dynare version are you using? I am not sure extended path supports the use_dll-version. @stepan-a might know.

Sorry for the confusion, I add hp_filter option in stoch_simul, I dont filter IRFs. So that comment of mine can be ignored.

I am using 4.5.7.

When I do stoch_simul with the use_dll option too, the steady state values are not picked up from the matlab file in to the oo_ object, the exo_simul vector is all 0’s and endo_simul is empty; even though stoch_simul runs fine without the use_dll option. To change to the use_dll option, I do two changes: “model(use_dll)” and “dynare mingw fast”. Am I missing something?

Thank you!

'stoch_simuldoes not useoo_.exo_simul`.

Sorry, the model(use_dll) option with stoch_simul does pick up the steady state values in to oo_.dr.ys, but oo_.endo_simul is empty and oo_.irfs is not created. Is something wrong here?

I would need to see the files