Page 1 of 1

Loop over parameters inside the mod file

PostPosted: Tue Feb 09, 2016 1:44 pm
by sodmoraes
Hi,

I want to look at some statistics of variables in the model when some parameters are modified. In my model, i wanna see the how the variables change when the composition of the public debt vary( "phi_N" represents the % of nominal bonds, "phi_b" is the % of bonds linked to the economy’s basic interest rate and [ 1 - phi_N - phi_b] represent the % of inflation indexed bonds; where the sum of the three bonds must be =1 ).

In the code in annex(line 101-103) ,i used simpe sintax like this:

Code: Select all
phi_Ns = [0 0.33 0.66 1];
for j=1:length(phi_Ns);
phi_N = phi_Ns(j);


But this loop isn´t optimal, since i have to state a fixed % to the bond linked to the economy interest rate( "phi_b"), and only "phi_N" and [ 1 - phi_N - phi_b] are changing. So i tried another loop, so i could change ,at the same time, both "phi_N" and "phi_b" (so i could get all the combinations of the three bonds that i want):

Code: Select all
phi_Ns = [0 0.33 0 1 0.33];
for j=1:length(phi_Ns);
phi_N = phi_Ns(j);

phi_bs = [0 0.66  1 0 0.33];
for j=1:length(phi_bs);
phi_b = phi_bs(j);


But it didn´t work...

I would be thankful for any help.
Regards,

Adriano

Re: Loop over parameters inside the mod file

PostPosted: Sat Feb 20, 2016 9:16 am
by jpfeifer
Please have a look at the structure outlined at http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=4891. You must loop outside of the mod-file, not within.