Looping Over Parameters - Problem in Steady State File

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.

Looping Over Parameters - Problem in Steady State File

Postby mjs19 » Sat Sep 05, 2015 10:53 pm

Hi,
I am trying to loop over parameter a value. I tried following this post, but it does not seem to work: viewtopic.php?f=1&t=4891

I am trying to loop over 'h' paramtere in NK_Baseline.mod as an example, but I get the error message:

Code: Select all
Some of the parameters have no value (h, ...


Here is the outside loop I am calling:

Code: Select all
params = 0:0.05:0.95;
for lpPar=1:length(params)
       
        set_param_value('h',params(lpPar));
        dynare NK_baseline noclearall; 

[STUFF]

end


Somehow it does not seem to recognize the value assignment I do when calling `set_param_value` (although I am able to call this function just fine).

Thanks.
mjs19
 
Posts: 16
Joined: Sat Jan 17, 2015 7:25 pm

Re: Looping Over Parameters - Problem in Steady State File

Postby jpfeifer » Sun Sep 06, 2015 8:16 am

That's because the call to
Code: Select all
dynare NK_baseline

will overwrite the initial statement setting h. That's why the post you refer to only calls resol/stoch_simul within the loop, but not full Dynare.
------------
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: Looping Over Parameters - Problem in Steady State File

Postby mjs19 » Sun Sep 06, 2015 12:39 pm

Is there anyway to work around that? Should I call the loop from inside dynare mod file?
Thanks.
mjs19
 
Posts: 16
Joined: Sat Jan 17, 2015 7:25 pm

Re: Looping Over Parameters - Problem in Steady State File

Postby jpfeifer » Sun Sep 06, 2015 1:07 pm

Please provide the files
------------
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: Looping Over Parameters - Problem in Steady State File

Postby mjs19 » Sun Sep 06, 2015 1:34 pm

I am working on posting some sample files, but if I just need to simulate new data with new parameter values, all I need is to follow the post I referred to? I am asking this because I wondering if just calling stoch_simul again with the new paramter would calculate the steady states again, since the changing parameters could potentiall y affect steady state.
Thanks.
mjs19
 
Posts: 16
Joined: Sat Jan 17, 2015 7:25 pm

Re: Looping Over Parameters - Problem in Steady State File

Postby jpfeifer » Sun Sep 06, 2015 2:12 pm

Yes, stoch_simul will recalculate the steady state (as does resol.m)
------------
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: Looping Over Parameters - Problem in Steady State File

Postby mjs19 » Sun Sep 06, 2015 9:31 pm

Great thanks. Managed to work around it.
mjs19
 
Posts: 16
Joined: Sat Jan 17, 2015 7:25 pm


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 2 guests

cron