Plotting of IRFs without running model

Hi all

Is there a way to plot the IRFs without running the model again?

Because I am trying to compare the IRFs for different sets of parameters and it’ll save a lot of computation time if I can find a way to get them without executing the command “dynare (model_name)” over and over again.

Thank you.

Hi all

With reference to my earlier post, I have an m file that can do the above already but I need something to replace the command “makeirfsecondorder”.

The error that appears when I execute that command is “Undefined function for input arguments of type ‘struct’.”

Thanks.

You have th values of irf in oo_ irf . Save the results file with a different name. Why don’t you put the irfs for all the shocks in a matrix and run them by setting up an m file

Hi hodabbbb

Thanks for your quick response!

I have tried plotting using oo_.irfs and it works. But now I realized I’m back to the original problem: how do I get the impulse responses after a change of parameters without having to run the model again?

Thanks.

You cannot . That’s the job th model does.save results with different names: 1.baseline 2.alternative. then compare

Hi hodabbbb

Again, thanks for your quick response.

I actually agree with you that if I were to change the parameters, I have to re-run the model again.

However, I thought I happened to chance upon this m file that can enable me to do simulate the IRFs without having to run the model again. I guess I probably overlooked something.

But either way, thanks for the help!

Hi hodabbbb

I actually realized that because I’m changing parameters that have nothing to do with the steady state, I don’t have to run the model again every time I change that parameter value.

So I can resolve for the new steady state using the following command “[dr_,~,M_,~,oo_] = resol(0,M1_,options1_,oo1_);”. Now the thing is how do I get the impulse response functions from this command?

What I have now is I run a loop such that if there is more than one change in the parameter, at the second change, I’ll skip the “dynare (my model)” command and just go straight to resolving for the new steady-state.

But now, my problem is how do I get the impulse responses from the new steady-state? Because previously, I can simply do oo_.irfs right? But for this, I definitely can’t do just that.

By the way, I think that using oo_.irfs to plot the IRFs might not be so general a way because, correct me if I’m wrong, but let’s say your shock comes from epsilon_z, then you gotta execute “plot(oo_.irfs.Y_epsilon_z)” but what if I have multiple shocks at one time? How do I plot the impulse response functions more generally?

Thanks.

First of all: even if the parameters you change do not affect steady states, they will alter the decision rules and require solving the model again.

What exactly are you trying to do? If we are talking about IRFs from different mod-files, the answer is here: [Q: combining IRFs into subplotted figures & iterating?). See also [Multiple Shocks and Multiple Plots (2 Questions))
If you just want to change a parameter within a mod-file and then generate the IRFs, do

stoch_simul(irf=x,order=x);
irf_set1=oo_.irfs;
set_param_value('betta',x)
stoch_simul(irf=x,order=x);
irf_set2=oo_.irfs;

and then plot the results directly from the structures. With the set_param_value you can change values of parameters (for standard deviations, use a new shocks-block with the reset option).

For multiple shocks: due to certainty equivalence at first order the IRFs to simultaneous shocks are just the sum of individual IRFs. At higher order, you need to use the simult_ function, see github.com/JohannesPfeifer/DSGE_mod/tree/master/RBC_news_shock_model

1 Like

Hi jpfeifer

First, thank you for all your responses.

I am now left with this issue out of all 3.

I’ve actually a way to do it but I encountered this error: Reference to non-existent field ‘nstatic’.

The reference to nstatic in my code is from: dr_.nstatic

Could you help explain why I have this error and how I can get round it?

Thank you.

I am not following where that error appears. nstatic is stored in M_, not in dr (dr also never is dr_).