diff --git a/doc/dynare.texi b/doc/dynare.texi index 388a7167c..456df1121 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -7485,6 +7485,15 @@ To set IRF restrictions with specific intervals, the following syntax is used When @code{(@var{INTEGER}:@var{INTEGER})} is used, the restriction is considered to be fulfilled by a logical OR. A list of restrictions must always be fulfilled with logical AND. +@optionshead + +@table @code + +@item relative_irf +@xref{relative_irf}. + +@end table + @examplehead @example diff --git a/preprocessor/DynareBison.yy b/preprocessor/DynareBison.yy index cc8524a81..f60ffa7a6 100644 --- a/preprocessor/DynareBison.yy +++ b/preprocessor/DynareBison.yy @@ -2524,6 +2524,8 @@ moment_calibration_item : symbol COMMA symbol COMMA calibration_range ';' irf_calibration : IRF_CALIBRATION ';' irf_calibration_list END ';' { driver.end_irf_calibration(); } + | IRF_CALIBRATION '(' o_relative_irf ')' ';' irf_calibration_list END ';' + { driver.end_irf_calibration(); } ; irf_calibration_list : irf_calibration_item diff --git a/preprocessor/DynareFlex.ll b/preprocessor/DynareFlex.ll index a1b92b1e2..1445c44db 100644 --- a/preprocessor/DynareFlex.ll +++ b/preprocessor/DynareFlex.ll @@ -303,7 +303,7 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2 posterior_max_subsample_draws {return token::POSTERIOR_MAX_SUBSAMPLE_DRAWS;} filtered_vars {return token::FILTERED_VARS;} filter_step_ahead {return token::FILTER_STEP_AHEAD;} -relative_irf {return token::RELATIVE_IRF;} +relative_irf {return token::RELATIVE_IRF;} tex {return token::TEX;} nomoments {return token::NOMOMENTS;} std {return token::STD;} diff --git a/preprocessor/ParsingDriver.cc b/preprocessor/ParsingDriver.cc index 26d0dc616..1880c1276 100644 --- a/preprocessor/ParsingDriver.cc +++ b/preprocessor/ParsingDriver.cc @@ -2763,7 +2763,8 @@ ParsingDriver::add_irf_calibration_item(string *endo, string *periods, string *e void ParsingDriver::end_irf_calibration() { mod_file->addStatement(new IrfCalibration(irf_calibration_constraints, - mod_file->symbol_table)); + mod_file->symbol_table, + options_list)); irf_calibration_constraints.clear(); } diff --git a/preprocessor/Shocks.cc b/preprocessor/Shocks.cc index b2ebd79ed..85ace03e6 100644 --- a/preprocessor/Shocks.cc +++ b/preprocessor/Shocks.cc @@ -436,14 +436,17 @@ MomentCalibration::writeOutput(ostream &output, const string &basename, bool min } IrfCalibration::IrfCalibration(const constraints_t &constraints_arg, - const SymbolTable &symbol_table_arg) - : constraints(constraints_arg), symbol_table(symbol_table_arg) + const SymbolTable &symbol_table_arg, + const OptionsList &options_list_arg) + : constraints(constraints_arg), symbol_table(symbol_table_arg), options_list(options_list_arg) { } void IrfCalibration::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const { + options_list.writeOutput(output); + output << "options_.endogenous_prior_restrictions.irf = {" << endl; for (size_t i = 0; i < constraints.size(); i++) { diff --git a/preprocessor/Shocks.hh b/preprocessor/Shocks.hh index 155ef967c..a78a154bf 100644 --- a/preprocessor/Shocks.hh +++ b/preprocessor/Shocks.hh @@ -133,9 +133,11 @@ public: private: constraints_t constraints; const SymbolTable &symbol_table; + const OptionsList options_list; public: IrfCalibration(const constraints_t &constraints_arg, - const SymbolTable &symbol_table_arg); + const SymbolTable &symbol_table_arg, + const OptionsList &options_list_arg); virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const; }; diff --git a/tests/gsa/ls2003a.mod b/tests/gsa/ls2003a.mod index 19d5f88ba..0bca629a7 100644 --- a/tests/gsa/ls2003a.mod +++ b/tests/gsa/ls2003a.mod @@ -69,8 +69,7 @@ stderr e_pies,inv_gamma_pdf,(1.88/3),(0.9827/10); end; // endogenous prior restrictions -options_.relative_irf=1; -irf_calibration; +irf_calibration(relative_irf); y(1:4), e_ys, [ -50 50]; //[first year response] //y(1:4), e_ys, [-inf -50]; //[first year response] @#for ilag in 21:40