Loop over parameters inside the mod 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.

Loop over parameters inside the mod file

Postby sodmoraes » Tue Feb 09, 2016 1:44 pm

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
Attachments
model.mod
(5.37 KiB) Downloaded 78 times
sodmoraes
 
Posts: 3
Joined: Sun Nov 01, 2015 12:52 pm

Re: Loop over parameters inside the mod file

Postby jpfeifer » Sat Feb 20, 2016 9:16 am

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.
------------
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: Google [Bot] and 11 guests