From 4c71d143f3fec395989950de51e7dee5836a37db Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Wed, 9 Jan 2019 14:48:25 +0100 Subject: [PATCH] substitute leads/lags appropriately when identification or sensitivity statements are present. Issue: https://git.dynare.org/Dynare/dynare/issues/1631 --- src/ComputingTasks.cc | 3 ++- src/ModFile.cc | 6 +++++- src/Statement.hh | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ComputingTasks.cc b/src/ComputingTasks.cc index 4266122d..ec587a82 100644 --- a/src/ComputingTasks.cc +++ b/src/ComputingTasks.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2018 Dynare Team + * Copyright (C) 2003-2019 Dynare Team * * This file is part of Dynare. * @@ -1203,6 +1203,7 @@ DynareSensitivityStatement::checkPass(ModFileStructure &mod_file_struct, Warning if (it != options_list.num_options.end() && it->second == "1") mod_file_struct.identification_present = true; + mod_file_struct.sensitivity_present = true; } void diff --git a/src/ModFile.cc b/src/ModFile.cc index 9c4578e6..25ef0a78 100644 --- a/src/ModFile.cc +++ b/src/ModFile.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2018 Dynare Team + * Copyright (C) 2006-2019 Dynare Team * * This file is part of Dynare. * @@ -142,6 +142,8 @@ ModFile::checkPass(bool nostrict, bool stochastic) || mod_file_struct.ramsey_policy_present || mod_file_struct.discretionary_policy_present || mod_file_struct.calib_smoother_present + || mod_file_struct.identification_present + || mod_file_struct.sensitivity_present || stochastic; // Allow empty model only when doing a standalone BVAR estimation @@ -565,6 +567,8 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const || mod_file_struct.ramsey_policy_present || mod_file_struct.discretionary_policy_present || mod_file_struct.calib_smoother_present + || mod_file_struct.identification_present + || mod_file_struct.sensitivity_present || stochastic ) { // In stochastic models, create auxiliary vars for leads and lags greater than 2, on both endos and exos diff --git a/src/Statement.hh b/src/Statement.hh index fb672604..d5c30c21 100644 --- a/src/Statement.hh +++ b/src/Statement.hh @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2017 Dynare Team + * Copyright (C) 2006-2019 Dynare Team * * This file is part of Dynare. * @@ -68,6 +68,8 @@ public: bool svar_identification_present{false}; //! Whether an identification statement is present or the identification option of dynare_sensitivity statement is equal to one bool identification_present{false}; + //! Whether a sensitivity statement is present + bool sensitivity_present{false}; //! Whether the option analytic_derivation is given to estimation bool estimation_analytic_derivation{false}; //! Whether the option partial_information is given to stoch_simul/estimation/osr/ramsey_policy