Plotting of IRFs without running model

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Plotting of IRFs without running model

Postby dphm » Fri Sep 18, 2015 11:53 pm

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.
dphm
 
Posts: 16
Joined: Fri Sep 11, 2015 12:27 am

Re: Plotting of IRFs without running model

Postby dphm » Sat Sep 19, 2015 12:32 am

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.
dphm
 
Posts: 16
Joined: Fri Sep 11, 2015 12:27 am

Re: Plotting of IRFs without running model

Postby hodabbbb » Sat Sep 19, 2015 7:59 am

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
hodabbbb
 
Posts: 39
Joined: Wed Mar 25, 2015 3:58 pm

Re: Plotting of IRFs without running model

Postby dphm » Sat Sep 19, 2015 1:33 pm

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.
dphm
 
Posts: 16
Joined: Fri Sep 11, 2015 12:27 am

Re: Plotting of IRFs without running model

Postby hodabbbb » Sat Sep 19, 2015 2:03 pm

You cannot . That's the job th model does.save results with different names: 1.baseline 2.alternative. then compare
hodabbbb
 
Posts: 39
Joined: Wed Mar 25, 2015 3:58 pm

Re: Plotting of IRFs without running model

Postby dphm » Sat Sep 19, 2015 3:25 pm

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!
dphm
 
Posts: 16
Joined: Fri Sep 11, 2015 12:27 am

Re: Plotting of IRFs without running model

Postby dphm » Sun Sep 20, 2015 12:00 am

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.
dphm
 
Posts: 16
Joined: Fri Sep 11, 2015 12:27 am

Re: Plotting of IRFs without running model

Postby jpfeifer » Mon Sep 21, 2015 11:44 am

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: http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5259. See also http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5049
If you just want to change a parameter within a mod-file and then generate the IRFs, do
Code: Select all
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 https://github.com/JohannesPfeifer/DSGE_mod/tree/master/RBC_news_shock_model
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Plotting of IRFs without running model

Postby dphm » Fri Sep 25, 2015 3:33 am

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.
dphm
 
Posts: 16
Joined: Fri Sep 11, 2015 12:27 am

Re: Plotting of IRFs without running model

Postby jpfeifer » Fri Sep 25, 2015 6:39 am

I am not following where that error appears. nstatic is stored in M_, not in dr (dr also never is dr_).
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 3 guests

cron