Preprocessor:
* new options to "identification" statement: "ar", "useautocorr", "load_ident_files", "prior_mc" * implement the call to dynare_identification() when "identification" statement is encountered * new options to "dynare_sensitivity" statement: "ar", "useautocorr", "load_ident_files" * trigger computation of model derivatives w.r. to parameters when "identification" option of "dynare_sensitivity" statement is used git-svn-id: https://www.dynare.org/svn/dynare/trunk@3046 ac1d8469-bf42-47a9-8791-bf33cf982152issue#70
parent
9ad86bfda2
commit
c8080438ad
|
@ -262,6 +262,15 @@ DynareSensitivityStatement::DynareSensitivityStatement(const OptionsList &option
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
DynareSensitivityStatement::checkPass(ModFileStructure &mod_file_struct)
|
||||
{
|
||||
OptionsList::num_options_type::const_iterator it = options_list.num_options.find("identification");
|
||||
if (it != options_list.num_options.end()
|
||||
&& it->second == "1")
|
||||
mod_file_struct.identification_present = true;
|
||||
}
|
||||
|
||||
void
|
||||
DynareSensitivityStatement::writeOutput(ostream &output, const string &basename) const
|
||||
{
|
||||
|
@ -952,7 +961,8 @@ MS_SBVARStatement::writeOutput(ostream &output, const string &basename) const
|
|||
|
||||
|
||||
|
||||
IdentificationStatement::IdentificationStatement()
|
||||
IdentificationStatement::IdentificationStatement(const OptionsList &options_list_arg) :
|
||||
options_list(options_list_arg)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -965,6 +975,8 @@ IdentificationStatement::checkPass(ModFileStructure &mod_file_struct)
|
|||
void
|
||||
IdentificationStatement::writeOutput(ostream &output, const string &basename) const
|
||||
{
|
||||
options_list.writeOutput(output, "options_ident");
|
||||
output << "dynare_identification(options_ident);" << endl;
|
||||
}
|
||||
|
||||
WriteLatexDynamicModelStatement::WriteLatexDynamicModelStatement(const DynamicModel &dynamic_model_arg) :
|
||||
|
|
|
@ -183,6 +183,7 @@ private:
|
|||
const OptionsList options_list;
|
||||
public:
|
||||
DynareSensitivityStatement(const OptionsList &options_list_arg);
|
||||
virtual void checkPass(ModFileStructure &mod_file_struct);
|
||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||
};
|
||||
|
||||
|
@ -432,10 +433,11 @@ public:
|
|||
|
||||
class IdentificationStatement : public Statement
|
||||
{
|
||||
private:
|
||||
const OptionsList options_list;
|
||||
public:
|
||||
IdentificationStatement();
|
||||
IdentificationStatement(const OptionsList &options_list_arg);
|
||||
virtual void checkPass(ModFileStructure &mod_file_struct);
|
||||
/*! \todo add something inside this method when Matlab code is available */
|
||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||
};
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ class ParsingDriver;
|
|||
%token <string_val> INT_NUMBER
|
||||
%token INV_GAMMA_PDF INV_GAMMA1_PDF INV_GAMMA2_PDF IRF
|
||||
%token KALMAN_ALGO KALMAN_TOL
|
||||
%token LAPLACE LIK_ALGO LIK_INIT LINEAR LOAD_MH_FILE LOAD_PARAMS_AND_STEADY_STATE LOGLINEAR
|
||||
%token LABELS LAPLACE LIK_ALGO LIK_INIT LINEAR LOAD_IDENT_FILES LOAD_MH_FILE LOAD_PARAMS_AND_STEADY_STATE LOGLINEAR
|
||||
%token MARKOWITZ MARGINAL_DENSITY MAX
|
||||
%token MFS MH_DROP MH_INIT_SCALE MH_JSCALE MH_MODE MH_NBLOCKS MH_REPLIC MH_RECOVER MIN
|
||||
%token MODE_CHECK MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MODEL_INFO MSHOCKS
|
||||
|
@ -114,15 +114,15 @@ class ParsingDriver;
|
|||
%token NOGRAPH NOMOMENTS NOPRINT NORMAL_PDF
|
||||
%token OBSERVATION_TRENDS OPTIM OPTIM_WEIGHTS ORDER OSR OSR_PARAMS
|
||||
%token PARAMETERS PERIODS PLANNER_OBJECTIVE PLOT_PRIORS PREFILTER PRESAMPLE
|
||||
%token PRINT PRIOR_TRUNC PRIOR_ANALYSIS POSTERIOR_ANALYSIS
|
||||
%token PRINT PRIOR_MC PRIOR_TRUNC PRIOR_ANALYSIS POSTERIOR_ANALYSIS
|
||||
%token <string_val> QUOTED_STRING
|
||||
%token QZ_CRITERIUM
|
||||
%token RELATIVE_IRF REPLIC RPLOT SAVE_PARAMS_AND_STEADY_STATE
|
||||
%token SHOCKS SIGMA_E SIMUL SIMUL_ALGO SIMUL_SEED SMOOTHER STACK_SOLVE_ALGO SOLVE_ALGO
|
||||
%token SHOCKS SHOCK_DECOMPOSITION SIGMA_E SIMUL SIMUL_ALGO SIMUL_SEED SMOOTHER STACK_SOLVE_ALGO SOLVE_ALGO
|
||||
%token STDERR STEADY STOCH_SIMUL
|
||||
%token TEX RAMSEY_POLICY PLANNER_DISCOUNT
|
||||
%token <string_val> TEX_NAME
|
||||
%token UNIFORM_PDF UNIT_ROOT_VARS USE_DLL SHOCK_DECOMPOSITION LABELS
|
||||
%token UNIFORM_PDF UNIT_ROOT_VARS USE_DLL USEAUTOCORR
|
||||
%token VALUES VAR VAREXO VAREXO_DET VAROBS
|
||||
%token WRITE_LATEX_DYNAMIC_MODEL WRITE_LATEX_STATIC_MODEL
|
||||
%token XLS_SHEET XLS_RANGE
|
||||
|
@ -1140,8 +1140,20 @@ save_params_and_steady_state : SAVE_PARAMS_AND_STEADY_STATE '(' filename ')' ';'
|
|||
|
||||
identification : IDENTIFICATION ';'
|
||||
{ driver.run_identification(); }
|
||||
| IDENTIFICATION '(' identification_options_list ')' ';'
|
||||
{ driver.run_identification(); }
|
||||
;
|
||||
|
||||
identification_options_list : identification_option COMMA identification_options_list
|
||||
| identification_option
|
||||
;
|
||||
|
||||
identification_option : o_ar
|
||||
| o_useautocorr
|
||||
| o_load_ident_files
|
||||
| o_prior_mc
|
||||
;
|
||||
|
||||
model_comparison : MODEL_COMPARISON mc_filename_list ';'
|
||||
{ driver.run_model_comparison(); }
|
||||
| MODEL_COMPARISON '(' o_marginal_density ')' mc_filename_list ';'
|
||||
|
@ -1444,6 +1456,9 @@ dynare_sensitivity_option : o_gsa_identification
|
|||
| o_loglinear
|
||||
| o_mode_file
|
||||
| o_gsa_trans_ident
|
||||
| o_load_ident_files
|
||||
| o_useautocorr
|
||||
| o_ar
|
||||
;
|
||||
|
||||
shock_decomposition_options_list : shock_decomposition_option COMMA shock_decomposition_options_list
|
||||
|
@ -1616,6 +1631,10 @@ o_gsa_alpha_rmse : ALPHA_RMSE EQUAL number { driver.option_num("alpha_rmse", $3)
|
|||
o_gsa_alpha2_rmse : ALPHA2_RMSE EQUAL number { driver.option_num("alpha2_rmse", $3); };
|
||||
o_gsa_trans_ident : TRANS_IDENT EQUAL INT_NUMBER { driver.option_num("trans_ident", $3); };
|
||||
|
||||
o_load_ident_files : LOAD_IDENT_FILES EQUAL INT_NUMBER { driver.option_num("load_ident_files", $3); }
|
||||
o_useautocorr : USEAUTOCORR EQUAL INT_NUMBER { driver.option_num("useautocorr", $3); }
|
||||
o_prior_mc : PRIOR_MC EQUAL INT_NUMBER { driver.option_num("prior_mc", $3); }
|
||||
|
||||
o_homotopy_mode : HOMOTOPY_MODE EQUAL INT_NUMBER {driver.option_num("homotopy_mode",$3); };
|
||||
o_homotopy_steps : HOMOTOPY_STEPS EQUAL INT_NUMBER {driver.option_num("homotopy_steps",$3); };
|
||||
|
||||
|
|
|
@ -460,8 +460,14 @@ int sigma_e = 0;
|
|||
<DYNARE_STATEMENT>alpha_rmse {return token::ALPHA_RMSE;}
|
||||
<DYNARE_STATEMENT>alpha2_rmse {return token::ALPHA2_RMSE;}
|
||||
<DYNARE_STATEMENT>trans_ident {return token::TRANS_IDENT;}
|
||||
<DYNARE_STATEMENT>load_ident_files {return token::LOAD_IDENT_FILES;}
|
||||
<DYNARE_STATEMENT>useautocorr {return token::USEAUTOCORR;}
|
||||
/* end of GSA options */
|
||||
|
||||
/* For identification() statement */
|
||||
<DYNARE_STATEMENT>prior_mc {return token::PRIOR_MC;}
|
||||
|
||||
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>[A-Za-z_][A-Za-z0-9_]* {
|
||||
yylval->string_val = new string(yytext);
|
||||
return token::NAME;
|
||||
|
|
|
@ -1000,7 +1000,8 @@ ParsingDriver::run_save_params_and_steady_state(string *filename)
|
|||
void
|
||||
ParsingDriver::run_identification()
|
||||
{
|
||||
mod_file->addStatement(new IdentificationStatement());
|
||||
mod_file->addStatement(new IdentificationStatement(options_list));
|
||||
options_list.clear();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
bool sbvar_present;
|
||||
//! Whether a sbvar statement is present
|
||||
bool ms_sbvar_present;
|
||||
//! Whether an identification statement is present
|
||||
//! Whether an identification statement is present or the identification option of dynare_sensitivity statement is equal to one
|
||||
bool identification_present;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue