diff --git a/doc/dynare.texi b/doc/dynare.texi index 388a7167c5573036a7745df6d5c2599075b3a298..456df1121104fb3f6522d06298f3297c033b7db5 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 cc8524a81f33cd263d546ed5294001c3f59aa29f..f60ffa7a64c896962727db8620c6f85fad9f1e46 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 a1b92b1e243c24b95544b5ebdddcbcf7ebe17a2f..1445c44dbe05514dbe5b1be25bab0903f6faf692 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 <DYNARE_STATEMENT>posterior_max_subsample_draws {return token::POSTERIOR_MAX_SUBSAMPLE_DRAWS;} <DYNARE_STATEMENT>filtered_vars {return token::FILTERED_VARS;} <DYNARE_STATEMENT>filter_step_ahead {return token::FILTER_STEP_AHEAD;} -<DYNARE_STATEMENT>relative_irf {return token::RELATIVE_IRF;} +<DYNARE_STATEMENT,DYNARE_BLOCK>relative_irf {return token::RELATIVE_IRF;} <DYNARE_STATEMENT>tex {return token::TEX;} <DYNARE_STATEMENT>nomoments {return token::NOMOMENTS;} <DYNARE_STATEMENT>std {return token::STD;} diff --git a/preprocessor/ParsingDriver.cc b/preprocessor/ParsingDriver.cc index 26d0dc6162de649f6fcc7a7d8c615a34814bc5f4..1880c12763ba51553074df66b011293cee98469d 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 b2ebd79ed5ee9f9dce353332318759662ba17cad..85ace03e645bd26c2d0a0a90bb2ec93b015cde96 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 155ef967ca23e883ead847ccd1a3264f7bb0a119..a78a154bf48927a38629e19392397ea245e36475 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 19d5f88bacb79ec1ae684d3f35291dc985eeb44a..0bca629a714d98c3bee585f378cf8d74ba4bf8ad 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