Page 1 of 1

Deterministic simulation from "non steady-state" values

PostPosted: Tue Dec 14, 2010 2:07 pm
by ludog
Hi all,

I would like to simulate a deterministic shock from values which are not a steady state.

First, I launch a simulation from a steady state to an other.
Code: Select all
initval;
@#include "steady_state1.mod"
end;
steady;

endval;
@#include "steady_state2.mod"
end;
steady;

simul(periods=400);

Where "steady_state1.mod" and "steady_state2.mod" are the two steady state saved from a program which calculate an approximate steady state.

Then, I extract values which are not steady state from the path in the vector "path1" and I try to save an other .mod (steady_state_TEST.mod) file like this:
Code: Select all
list_var = cellstr(M_.endo_names);

fid = fopen('steady_state_TEST.mod', 'w');
for i=1:length(list_var)
            fprintf(fid, '%s = %.16g;\n',list_var{i}, path1(i));
end
   
list_var_exo = cellstr(M_.exo_names);
for i=1:length(list_var_exo)
       fprintf(fid, '%s = %.16g;\n',list_var_exo{i}, oo_.exo_steady_state(i));
end
fclose(fid);


But the program does not execute fid, loops for...etc

And finally, I would like to launch an other simulation with "steady_state_TEST.mod" in initval and a steady state in endval.
But, since the program does not execute fid..etc it does not find steady_state_TEST.mod.

Is there anyone who can help me?
Perhap's my problem comes from loops "for"?

Best Regards.

L.

Re: Deterministic simulation from "non steady-state" values

PostPosted: Tue Jan 11, 2011 11:20 am
by SébastienVillemot
You cannot do everything that you describe from within Dynare, but I think you can do it by alternating runs of Dynare and of MATLAB programs.

You can run Dynare for getting the first path, then run a MATLAB program which creates the steady_state_TEST.mod file, and then run Dynare a second time (on another MOD file which includes the steady_state_TEST.mod).