MODEL SIMULATION for several values of a parameter

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.

MODEL SIMULATION for several values of a parameter

Postby sanga » Mon Mar 23, 2015 2:08 pm

Hi,
I would like to simulate a model with DYNARE by limiting the value of one parameter to a defined range (from 0.1 to 1.5, with 0.01 as size of increment) and extract the outcome for each value of this parameter within the range.
Please, Can you help me ? How to do that with dynare?
Any idea will be welcomed and appreciated.
Best,
sanga
 
Posts: 24
Joined: Sat Mar 31, 2012 8:50 pm

Re: MODEL SIMULATION for several values of a parameter

Postby jpfeifer » Mon Mar 23, 2015 2:33 pm

------------
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: MODEL SIMULATION for several values of a parameter

Postby sanga » Tue Mar 24, 2015 3:09 pm

Thank Jpfeifer, I will try to see it.
sanga
 
Posts: 24
Joined: Sat Mar 31, 2012 8:50 pm

Re: MODEL SIMULATION for several values of a parameter

Postby sanga » Wed Apr 01, 2015 10:32 pm

Dear Johannes,

I am trying to find moments and IRF of some variables when 2 and 3 policy parametrs change. I made the following loops in separate matlab-files, which run, but I need help in order to save and extract moments and IRF when the loop is over 2 or 3 parameters.

betha1s= 1.5:0.1:1.9;

for i=1:length(betha1s)

betha2s=0.5:0.1:0.6;
for j=1:length(betha2s)
set_param_value('betha1',betha1s(i));
set_param_value('betha2',betha2s(j));
dynare pays_111_sP noclearall;
moments(:,i)=diag(oo_.var);

end

save(['results_',num2str(j)])

end


Questions: 1) This code runs, but not able to give me the moment change over parameter values (here, 10 variances). I get only 2 or 5 variances instead of 10. How to do that?
2) How can I save and call IRFs for some variables using the 2 loops?
sanga
 
Posts: 24
Joined: Sat Mar 31, 2012 8:50 pm

Re: MODEL SIMULATION for several values of a parameter

Postby jpfeifer » Thu Apr 02, 2015 9:32 am

This is not the correct way to do it. Please provide your 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: MODEL SIMULATION for several values of a parameter

Postby sanga » Thu Apr 02, 2015 11:18 am

Please Johannes,
Herewith the files.
Thanks! in advance,
Attachments
parameterfile.m
(1.04 KiB) Downloaded 62 times
pays_111_sP.mod
(3.01 KiB) Downloaded 66 times
sanga
 
Posts: 24
Joined: Sat Mar 31, 2012 8:50 pm

Re: MODEL SIMULATION for several values of a parameter

Postby jpfeifer » Thu Apr 02, 2015 7:05 pm

The attached file should do what you want.
Attachments
pays_111_sp.zip
File running simulations and saving variances in a two-fold loop
(1.93 KiB) Downloaded 115 times
------------
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: MODEL SIMULATION for several values of a parameter

Postby sanga » Thu Apr 02, 2015 8:51 pm

Dear Johannes,
Thank you very much, this has been very helpful for me.
Best,
sanga
 
Posts: 24
Joined: Sat Mar 31, 2012 8:50 pm

Re: MODEL SIMULATION for several values of a parameter

Postby sanga » Thu Apr 02, 2015 8:59 pm

Dear Johannes,
Please if I will just extract the IRF for these 2-loops, I need to add which code line?
Best,
sanga
 
Posts: 24
Joined: Sat Mar 31, 2012 8:50 pm

Re: MODEL SIMULATION for several values of a parameter

Postby macroresearch123 » Fri Apr 03, 2015 5:56 pm

Maybe I'm missing something here, but you could just add a line that is of the form:

xirf(i)=oo_.irfs.C_eps_x(i)

where x is the shock of interest
macroresearch123
 
Posts: 90
Joined: Wed Nov 06, 2013 3:28 pm

Re: MODEL SIMULATION for several values of a parameter

Postby sanga » Fri Apr 03, 2015 7:57 pm

Thank you,
But there are some things you missed, because i am looking for the 2 loops IRFs, like xirf(i,j).
Do you have any hints?
sanga
 
Posts: 24
Joined: Sat Mar 31, 2012 8:50 pm

Re: MODEL SIMULATION for several values of a parameter

Postby jpfeifer » Mon Apr 06, 2015 8:34 pm

Something like:

Code: Select all
xirf(:,i,j)=oo_.irfs.C_eps_x
------------
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: MODEL SIMULATION for several values of a parameter

Postby sanga » Tue Apr 07, 2015 8:29 am

Thank you Johaness, It seems to work.
sanga
 
Posts: 24
Joined: Sat Mar 31, 2012 8:50 pm


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 8 guests