Page 1 of 1

Looping Over Parameters - Problem in Steady State File

PostPosted: Sat Sep 05, 2015 10:53 pm
by mjs19
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.

Re: Looping Over Parameters - Problem in Steady State File

PostPosted: Sun Sep 06, 2015 8:16 am
by jpfeifer
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.

Re: Looping Over Parameters - Problem in Steady State File

PostPosted: Sun Sep 06, 2015 12:39 pm
by mjs19
Is there anyway to work around that? Should I call the loop from inside dynare mod file?
Thanks.

Re: Looping Over Parameters - Problem in Steady State File

PostPosted: Sun Sep 06, 2015 1:07 pm
by jpfeifer
Please provide the files

Re: Looping Over Parameters - Problem in Steady State File

PostPosted: Sun Sep 06, 2015 1:34 pm
by mjs19
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.

Re: Looping Over Parameters - Problem in Steady State File

PostPosted: Sun Sep 06, 2015 2:12 pm
by jpfeifer
Yes, stoch_simul will recalculate the steady state (as does resol.m)

Re: Looping Over Parameters - Problem in Steady State File

PostPosted: Sun Sep 06, 2015 9:31 pm
by mjs19
Great thanks. Managed to work around it.