Merge branch 'evaluate_planner' into 'master'

evaluate_planner_objective.m: correctly rely on lag/lead structure for perfect foresight

See merge request Dynare/dynare!1890
trust-region-mex
Sébastien Villemot 2021-07-23 14:01:22 +00:00
commit b34be496c5
2 changed files with 42 additions and 44 deletions

View File

@ -91,10 +91,10 @@ planner_objective_value = zeros(2,1);
if options_.ramsey_policy
if oo_.gui.ran_perfect_foresight
T = size(oo_.endo_simul,2);
[U_term] = feval([M_.fname '.objective.static'],oo_.endo_simul(:,T),oo_.exo_simul(T,:), M_.params);
[U_term] = feval([M_.fname '.objective.static'],oo_.endo_simul(:,T-M_.maximum_lead),oo_.exo_simul(T-M_.maximum_lead,:), M_.params);
EW = U_term/(1-beta);
W = EW;
for t=T:-1:2
for t=T-M_.maximum_lead:-1:1+M_.maximum_lag
[U] = feval([M_.fname '.objective.static'],oo_.endo_simul(:,t),oo_.exo_simul(t,:), M_.params);
W = U + beta*W;
end
@ -229,9 +229,6 @@ elseif options_.discretionary_policy
Wbar = U/(1-beta);
Wy = Uy*gy/(eye(nspred)-beta*Gy);
if isempty(options_.qz_criterium)
options_.qz_criterium = 1+1e-6;
end
%solve Lyapunuv equation Wyy=gy'*Uyy*gy+beta*Gy'Wyy*Gy
Wyy = reshape(lyapunov_symm(sqrt(beta)*Gy',reshape(Uyygygy,nspred,nspred),options_.lyapunov_fixed_point_tol,options_.qz_criterium,options_.lyapunov_complex_threshold, 3, options_.debug),1,nspred*nspred);
Wyygugu = A_times_B_kronecker_C(Wyy,Gu,Gu);

View File

@ -23,7 +23,7 @@ r=1;
end;
histval;
r(0)=1;
a(0)=-1;
end;
steady_state_model;
@ -42,4 +42,5 @@ end;
options_.dr_display_tol=0;
planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma)));
ramsey_model(planner_discount=0.99,instruments=(r));
stoch_simul(order=1,periods=500);
stoch_simul(order=1);
evaluate_planner_objective;