preprocessor: add relative_irf option to irf_calibration block. closes #720

time-shift
Houtan Bastani 2015-09-07 11:39:33 +02:00
parent e5e9bdb892
commit 8d54aeeaf6
7 changed files with 23 additions and 7 deletions

View File

@ -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. 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. A list of restrictions must always be fulfilled with logical AND.
@optionshead
@table @code
@item relative_irf
@xref{relative_irf}.
@end table
@examplehead @examplehead
@example @example

View File

@ -2524,6 +2524,8 @@ moment_calibration_item : symbol COMMA symbol COMMA calibration_range ';'
irf_calibration : IRF_CALIBRATION ';' irf_calibration_list END ';' irf_calibration : IRF_CALIBRATION ';' irf_calibration_list END ';'
{ driver.end_irf_calibration(); } { driver.end_irf_calibration(); }
| IRF_CALIBRATION '(' o_relative_irf ')' ';' irf_calibration_list END ';'
{ driver.end_irf_calibration(); }
; ;
irf_calibration_list : irf_calibration_item irf_calibration_list : irf_calibration_item

View File

@ -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>posterior_max_subsample_draws {return token::POSTERIOR_MAX_SUBSAMPLE_DRAWS;}
<DYNARE_STATEMENT>filtered_vars {return token::FILTERED_VARS;} <DYNARE_STATEMENT>filtered_vars {return token::FILTERED_VARS;}
<DYNARE_STATEMENT>filter_step_ahead {return token::FILTER_STEP_AHEAD;} <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>tex {return token::TEX;}
<DYNARE_STATEMENT>nomoments {return token::NOMOMENTS;} <DYNARE_STATEMENT>nomoments {return token::NOMOMENTS;}
<DYNARE_STATEMENT>std {return token::STD;} <DYNARE_STATEMENT>std {return token::STD;}

View File

@ -2763,7 +2763,8 @@ ParsingDriver::add_irf_calibration_item(string *endo, string *periods, string *e
void ParsingDriver::end_irf_calibration() void ParsingDriver::end_irf_calibration()
{ {
mod_file->addStatement(new IrfCalibration(irf_calibration_constraints, mod_file->addStatement(new IrfCalibration(irf_calibration_constraints,
mod_file->symbol_table)); mod_file->symbol_table,
options_list));
irf_calibration_constraints.clear(); irf_calibration_constraints.clear();
} }

View File

@ -436,14 +436,17 @@ MomentCalibration::writeOutput(ostream &output, const string &basename, bool min
} }
IrfCalibration::IrfCalibration(const constraints_t &constraints_arg, IrfCalibration::IrfCalibration(const constraints_t &constraints_arg,
const SymbolTable &symbol_table_arg) const SymbolTable &symbol_table_arg,
: constraints(constraints_arg), symbol_table(symbol_table_arg) const OptionsList &options_list_arg)
: constraints(constraints_arg), symbol_table(symbol_table_arg), options_list(options_list_arg)
{ {
} }
void void
IrfCalibration::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const IrfCalibration::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
{ {
options_list.writeOutput(output);
output << "options_.endogenous_prior_restrictions.irf = {" << endl; output << "options_.endogenous_prior_restrictions.irf = {" << endl;
for (size_t i = 0; i < constraints.size(); i++) for (size_t i = 0; i < constraints.size(); i++)
{ {

View File

@ -133,9 +133,11 @@ public:
private: private:
constraints_t constraints; constraints_t constraints;
const SymbolTable &symbol_table; const SymbolTable &symbol_table;
const OptionsList options_list;
public: public:
IrfCalibration(const constraints_t &constraints_arg, 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; virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
}; };

View File

@ -69,8 +69,7 @@ stderr e_pies,inv_gamma_pdf,(1.88/3),(0.9827/10);
end; end;
// endogenous prior restrictions // endogenous prior restrictions
options_.relative_irf=1; irf_calibration(relative_irf);
irf_calibration;
y(1:4), e_ys, [ -50 50]; //[first year response] y(1:4), e_ys, [ -50 50]; //[first year response]
//y(1:4), e_ys, [-inf -50]; //[first year response] //y(1:4), e_ys, [-inf -50]; //[first year response]
@#for ilag in 21:40 @#for ilag in 21:40