Loop over parameters inside the mod file


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:

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]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.

model.mod (5.37 KB)

Please have a look at the structure outlined at [Loop over parameters). You must loop outside of the mod-file, not within.