Page 1 of 1

MODEL SIMULATION for several values of a parameter

PostPosted: Mon Mar 23, 2015 2:08 pm
by sanga
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,

Re: MODEL SIMULATION for several values of a parameter

PostPosted: Mon Mar 23, 2015 2:33 pm
by jpfeifer

Re: MODEL SIMULATION for several values of a parameter

PostPosted: Tue Mar 24, 2015 3:09 pm
by sanga
Thank Jpfeifer, I will try to see it.

Re: MODEL SIMULATION for several values of a parameter

PostPosted: Wed Apr 01, 2015 10:32 pm
by sanga
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?

Re: MODEL SIMULATION for several values of a parameter

PostPosted: Thu Apr 02, 2015 9:32 am
by jpfeifer
This is not the correct way to do it. Please provide your files.

Re: MODEL SIMULATION for several values of a parameter

PostPosted: Thu Apr 02, 2015 11:18 am
by sanga
Please Johannes,
Herewith the files.
Thanks! in advance,

Re: MODEL SIMULATION for several values of a parameter

PostPosted: Thu Apr 02, 2015 7:05 pm
by jpfeifer
The attached file should do what you want.

Re: MODEL SIMULATION for several values of a parameter

PostPosted: Thu Apr 02, 2015 8:51 pm
by sanga
Dear Johannes,
Thank you very much, this has been very helpful for me.
Best,

Re: MODEL SIMULATION for several values of a parameter

PostPosted: Thu Apr 02, 2015 8:59 pm
by sanga
Dear Johannes,
Please if I will just extract the IRF for these 2-loops, I need to add which code line?
Best,

Re: MODEL SIMULATION for several values of a parameter

PostPosted: Fri Apr 03, 2015 5:56 pm
by macroresearch123
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

Re: MODEL SIMULATION for several values of a parameter

PostPosted: Fri Apr 03, 2015 7:57 pm
by sanga
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?

Re: MODEL SIMULATION for several values of a parameter

PostPosted: Mon Apr 06, 2015 8:34 pm
by jpfeifer
Something like:

Code: Select all
xirf(:,i,j)=oo_.irfs.C_eps_x

Re: MODEL SIMULATION for several values of a parameter

PostPosted: Tue Apr 07, 2015 8:29 am
by sanga
Thank you Johaness, It seems to work.