From daa6b5569dbd2c539fe79376e8f48f328bd258cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 18 Oct 2023 10:19:46 -0400
Subject: [PATCH] mshocks: better match to the semantics given in the manual

Ensure that the block is always interpreted multiplicatively relative to the
steady state, and not relative to the pre-existing shock value (if there was
already a shock declared for the same exogenous and period(s)).
---
 matlab/perfect-foresight-models/make_ex_.m                    | 4 ++--
 .../perfect_foresight_with_expectation_errors_setup.m         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/matlab/perfect-foresight-models/make_ex_.m b/matlab/perfect-foresight-models/make_ex_.m
index 4442d03f02..37ade675f4 100644
--- a/matlab/perfect-foresight-models/make_ex_.m
+++ b/matlab/perfect-foresight-models/make_ex_.m
@@ -89,13 +89,13 @@ if isfield(M_, 'det_shocks')
             if ~M_.det_shocks(i).multiplicative
                 oo_.exo_simul(k,ivar) = v;
             else
-                oo_.exo_simul(k,ivar) = oo_.exo_simul(k,ivar) .* v;
+                oo_.exo_simul(k,ivar) = oo_.exo_steady_state(ivar) * v;
             end
         else
             if ~M_.det_shocks(i).multiplicative
                 oo_.exo_det_simul(k,ivar) = v;
             else
-                oo_.exo_det_simul(k,ivar) = oo_.exo_det_simul(k,ivar) .* v;
+                oo_.exo_det_simul(k,ivar) = oo_.exo_det_steady_state(ivar) * v;
             end
         end
     end
diff --git a/matlab/perfect-foresight-models/perfect_foresight_with_expectation_errors_setup.m b/matlab/perfect-foresight-models/perfect_foresight_with_expectation_errors_setup.m
index d3c76668cb..33c418d449 100644
--- a/matlab/perfect-foresight-models/perfect_foresight_with_expectation_errors_setup.m
+++ b/matlab/perfect-foresight-models/perfect_foresight_with_expectation_errors_setup.m
@@ -78,7 +78,7 @@ else
             if ~M_.det_shocks(i).multiplicative
                 oo_.pfwee.shocks_info(exo_id, prds, 1) = v;
             else
-                oo_.pfwee.shocks_info(exo_id, prds, 1) = oo_.pfwee.shocks_info(exo_id, prds, 1) .* v;
+                oo_.pfwee.shocks_info(exo_id, prds, 1) = oo_.exo_steady_state(exo_id) * v;
             end
         end
     end
-- 
GitLab