From 75feb048635db76f1c36cc8e6d89739262b160c4 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer <jpfeifer@gmx.de> Date: Sat, 11 Sep 2021 09:41:08 +0200 Subject: [PATCH] evaluate_planner_objective.m: fix wrong timing in setting of shocks (cherry picked from commit 334020fc463f2665d5553fc67f15a7a4ba46a167) --- matlab/evaluate_planner_objective.m | 10 +++++++--- tests/optimal_policy/Ramsey/ramsey_histval.mod | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/matlab/evaluate_planner_objective.m b/matlab/evaluate_planner_objective.m index 162953a37d..3a516b31be 100644 --- a/matlab/evaluate_planner_objective.m +++ b/matlab/evaluate_planner_objective.m @@ -347,11 +347,15 @@ if ~isempty(M_.det_shocks) end u =oo_.exo_steady_state; periods=[M_.det_shocks(:).periods]; - if ~all(periods==0) - fprintf(['\nevaluate_planner_objective: Shock values for periods other than the intial period 0 have been provided.\n' ... + if any(periods==0) + fprintf(['\nevaluate_planner_objective: M_.det_shocks contains values for the predetermined t=0 period.\n'... + 'evaluate_planner_objective: Dynare will ignore them. Use histval to set the value of lagged innovations.\n']) + end + if any(periods>1) + fprintf(['\nevaluate_planner_objective: Shock values for periods not contained in the initial information set (t=1) have been provided.\n' ... 'evaluate_planner_objective: Note that they will be ignored.\n']) end - shock_indices=find(periods==0); + shock_indices=find(periods==1); if any([M_.det_shocks(shock_indices).multiplicative]) fprintf(['\nevaluate_planner_objective: Shock values need to be specified as additive.\n']) end diff --git a/tests/optimal_policy/Ramsey/ramsey_histval.mod b/tests/optimal_policy/Ramsey/ramsey_histval.mod index d237f0cea6..5f296a7409 100644 --- a/tests/optimal_policy/Ramsey/ramsey_histval.mod +++ b/tests/optimal_policy/Ramsey/ramsey_histval.mod @@ -37,8 +37,8 @@ end; shocks; var u; stderr 0.008; var u; -periods 0; -values 1; +periods 0, 1; +values 1, 1; end; options_.dr_display_tol=0; planner_objective(ln(c)-phi*((n^(1+gamma))/(1+gamma))); -- GitLab