Page 1 of 1

Loop parameters

PostPosted: Thu Oct 04, 2012 5:40 pm
by Vorada Limjaroenrat
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,

Re: Loop parameters

PostPosted: Sun Oct 07, 2012 3:09 am
by Vorada Limjaroenrat
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,

Re: Loop parameters

PostPosted: Wed Oct 31, 2012 4:51 pm
by SébastienVillemot
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_;