From b6c0850fb730464b886a7558da8cf50b8d181b2e Mon Sep 17 00:00:00 2001 From: ferhat Date: Mon, 28 Oct 2013 14:22:23 +0100 Subject: [PATCH] Add a flag for calib_smoother command and apply a setup similar to the one used for stoch_simul command: - Add auxiliary variables for leaded and lagged exogenous - Set the cutoff applied to the Jacobian at zero for the static and the dynamic models --- ComputingTasks.cc | 6 ++++++ ComputingTasks.hh | 1 + ModFile.cc | 15 ++++++++++----- Statement.cc | 3 ++- Statement.hh | 2 ++ 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/ComputingTasks.cc b/ComputingTasks.cc index 458a1db2..9434b315 100644 --- a/ComputingTasks.cc +++ b/ComputingTasks.cc @@ -2411,6 +2411,12 @@ CalibSmootherStatement::CalibSmootherStatement(const SymbolList &symbol_list_arg { } +void +CalibSmootherStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings) +{ + mod_file_struct.calib_smoother_present = true; +} + void CalibSmootherStatement::writeOutput(ostream &output, const string &basename) const { diff --git a/ComputingTasks.hh b/ComputingTasks.hh index 926e082d..59c6a264 100644 --- a/ComputingTasks.hh +++ b/ComputingTasks.hh @@ -516,6 +516,7 @@ private: public: CalibSmootherStatement(const SymbolList &symbol_list_arg, const OptionsList &options_list_arg); + virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings); virtual void writeOutput(ostream &output, const string &basename) const; }; diff --git a/ModFile.cc b/ModFile.cc index 4ef0ab43..631dc4fa 100644 --- a/ModFile.cc +++ b/ModFile.cc @@ -123,7 +123,8 @@ ModFile::checkPass() || mod_file_struct.estimation_present || mod_file_struct.osr_present || mod_file_struct.ramsey_policy_present - || mod_file_struct.discretionary_policy_present; + || mod_file_struct.discretionary_policy_present + || mod_file_struct.calib_smoother_present; // Allow empty model only when doing a standalone BVAR estimation if (dynamic_model.equation_number() == 0 @@ -318,7 +319,8 @@ ModFile::transformPass(bool nostrict) || mod_file_struct.estimation_present || mod_file_struct.osr_present || mod_file_struct.ramsey_policy_present - || mod_file_struct.discretionary_policy_present) + || mod_file_struct.discretionary_policy_present + || mod_file_struct.calib_smoother_present) { // In stochastic models, create auxiliary vars for leads and lags greater than 2, on both endos and exos dynamic_model.substituteEndoLeadGreaterThanTwo(false); @@ -423,7 +425,8 @@ ModFile::computingPass(bool no_tmp_terms) { if (mod_file_struct.stoch_simul_present || mod_file_struct.estimation_present || mod_file_struct.osr_present - || mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present) + || mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present + || mod_file_struct.calib_smoother_present) static_model.set_cutoff_to_zero(); const bool static_hessian = mod_file_struct.identification_present @@ -437,7 +440,8 @@ ModFile::computingPass(bool no_tmp_terms) if (mod_file_struct.simul_present || mod_file_struct.check_present || mod_file_struct.stoch_simul_present || mod_file_struct.estimation_present || mod_file_struct.osr_present - || mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present) + || mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present + || mod_file_struct.calib_smoother_present) { if (mod_file_struct.simul_present) dynamic_model.computingPass(true, false, false, false, global_eval_context, no_tmp_terms, block, use_dll, byte_code); @@ -445,7 +449,8 @@ ModFile::computingPass(bool no_tmp_terms) { if (mod_file_struct.stoch_simul_present || mod_file_struct.estimation_present || mod_file_struct.osr_present - || mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present) + || mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present + || mod_file_struct.calib_smoother_present) dynamic_model.set_cutoff_to_zero(); if (mod_file_struct.order_option < 1 || mod_file_struct.order_option > 3) { diff --git a/Statement.cc b/Statement.cc index 59021287..af77dc24 100644 --- a/Statement.cc +++ b/Statement.cc @@ -47,7 +47,8 @@ ModFileStructure::ModFileStructure() : dsge_var_estimated(false), bayesian_irf_present(false), estimation_data_statement_present(false), - last_markov_switching_chain(0) + last_markov_switching_chain(0), + calib_smoother_present(false) { } diff --git a/Statement.hh b/Statement.hh index cd3fd5cf..493dabfa 100644 --- a/Statement.hh +++ b/Statement.hh @@ -57,6 +57,8 @@ public: bool planner_objective_present; //! Whether an extended_path statement is present bool extended_path_present; + //! Whether a calib_smoother statement is present + bool calib_smoother_present; //! The value of the "order" option of stoch_simul, estimation, osr, ramsey_policy //! Derivation order /*! First initialized to zero. If user sets order option somewhere in the MOD file, it will be equal to the maximum of order options. Otherwise will default to 2 */