Added an option to skip the test on the number of periods over which the perfect foresight models are solved.

time-shift
Stéphane Adjemian (Charybdis) 2012-02-04 16:19:15 +01:00
parent 3f2d2b3497
commit 8a35ee7363
2 changed files with 87 additions and 75 deletions

View File

@ -81,6 +81,10 @@ pfm.i_upd = pfm.ny+(1:pfm.periods*pfm.ny);
% Set the algorithm for the perfect foresight solver
options_.stack_solve_algo = options_.ep.stack_solve_algo;
% Set check_stability flag
do_not_check_stability_flag = ~options_.ep.check_stability;
% Compute the first order reduced form if needed.
%
% REMARK. It is assumed that the user did run the same mod file with stoch_simul(order=1) and save
@ -248,6 +252,11 @@ while (t<sample_size)
end
end
end
if do_not_check_stability_flag
% Exit from the while loop.
oo_.endo_simul = tmp;
break
else
% Test if periods is big enough.
% Increase the number of periods.
options_.periods = options_.periods + options_.ep.step;
@ -326,6 +335,7 @@ while (t<sample_size)
break
end
end% if info.convergence
end
end% while
if ~info.convergence% If exited from the while loop without achieving convergence, use an homotopic approach
[INFO,tmp] = homotopic_steps(.5,.01);

View File

@ -126,6 +126,8 @@ ep.maxit = 500;
ep.periods = 200;
% Default step for increasing the number of periods if needed
ep.step = 50;
% Set check_stability flag
ep.check_stability = 1;
% Define last periods used to test if the solution is stable with respect to an increase in the number of periods.
ep.lp = 5;
% Define first periods used to test if the solution is stable with respect to an increase in the number of periods.