Loop parameters

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 parameters

Postby Vorada Limjaroenrat » Thu Oct 04, 2012 5:40 pm

Dear dynare people,
As i am a truly beginner, basic problems again. I want to generate a loop of parameters and hope the IRF will show different values of parameters in one IRF graph. Is that possible? Please suggest me the way to do that.....
Your kindness is highly appreciated,
Vorada Limjaroenrat
 
Posts: 10
Joined: Tue Oct 02, 2012 7:43 pm

Re: Loop parameters

Postby Vorada Limjaroenrat » Sun Oct 07, 2012 3:09 am

Dear experts,
i have already figure the way to loop parameter but still can't figure out the way to save the IRF results from the loop. Please suggest me some idea i don't know why the code didn't work :(

Here is my code

alphas = 0.4:0.1:0.6;
@#for i in 1:3
alpha = alphas(@{i});

stoch_simul(order=1, irf=20) y pih x pi r s e ;
if info;
disp(['Computation fails for alpha = ' num2str(alpha)]);
end;
dynasave savedresults@{i};
@#endfor;


Here is my error
Configuring Dynare ...
[mex] Generalized QZ.
[mex] Sylvester equation solution.
[mex] Kronecker products.
[mex] Sparse kronecker products.
[mex] Bytecode evaluation.
[mex] k-order perturbation solver.
[mex] k-order solution simulation.

Starting Dynare (version 4.2.5).
Starting preprocessing of the model file ...
ERROR in macro-processor: PlainVanilla.mod:17.15-16: @#for loop not matched by an @#endfor (unexpected end of file)

Error using dynare (line 114)
DYNARE: preprocessing failed



one thing, can i do it with Matlab/octave like this
alphas = [ 0.4,0.6,0.8];
for i = 1:length(alphas)
alpha = alphas(i);

but how do i save the irf result from this sice i want to use matlab to further combine the irf graph
Million of thanks for your help,
Vorada Limjaroenrat
 
Posts: 10
Joined: Tue Oct 02, 2012 7:43 pm

Re: Loop parameters

Postby SébastienVillemot » Wed Oct 31, 2012 4:51 pm

The IRF is stored in the "oo_" structure. The solution is probably to save that variable in a different MAT-file at each iteration, like:

Code: Select all
save results@{i} oo_;
Sébastien Villemot
Economist at OFCE – Sciences Po
SébastienVillemot
 
Posts: 706
Joined: Fri Dec 07, 2007 2:29 pm
Location: Paris, France


Return to Dynare help

Who is online

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