Rename “dynare_sensitivity” command to “sensitivity”

The old name is still accepted, but will trigger a deprecation warning.
master
Sébastien Villemot 2023-12-14 18:37:10 +01:00
parent 8d0e8cca5c
commit 0f397f40af
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
6 changed files with 89 additions and 78 deletions

View File

@ -1070,14 +1070,14 @@ EstimationStatement::writeJsonOutput(ostream& output) const
output << "}";
}
DynareSensitivityStatement::DynareSensitivityStatement(OptionsList options_list_arg) :
SensitivityStatement::SensitivityStatement(OptionsList options_list_arg) :
options_list {move(options_list_arg)}
{
}
void
DynareSensitivityStatement::checkPass(ModFileStructure& mod_file_struct,
[[maybe_unused]] WarningConsolidation& warnings)
SensitivityStatement::checkPass(ModFileStructure& mod_file_struct,
[[maybe_unused]] WarningConsolidation& warnings)
{
if (auto opt = options_list.get_if<OptionsList::NumVal>("identification"); opt && *opt == "1")
{
@ -1089,8 +1089,8 @@ DynareSensitivityStatement::checkPass(ModFileStructure& mod_file_struct,
}
void
DynareSensitivityStatement::writeOutput(ostream& output, [[maybe_unused]] const string& basename,
[[maybe_unused]] bool minimal_workspace) const
SensitivityStatement::writeOutput(ostream& output, [[maybe_unused]] const string& basename,
[[maybe_unused]] bool minimal_workspace) const
{
options_list.writeOutput(output, "options_gsa");
@ -1110,9 +1110,9 @@ DynareSensitivityStatement::writeOutput(ostream& output, [[maybe_unused]] const
}
void
DynareSensitivityStatement::writeJsonOutput(ostream& output) const
SensitivityStatement::writeJsonOutput(ostream& output) const
{
output << R"({"statementName": "dynare_sensitivity")";
output << R"({"statementName": "sensitivity")";
if (!options_list.empty())
{
output << ", ";

View File

@ -334,13 +334,13 @@ public:
void writeJsonOutput(ostream& output) const override;
};
class DynareSensitivityStatement : public Statement
class SensitivityStatement : public Statement
{
private:
const OptionsList options_list;
public:
explicit DynareSensitivityStatement(OptionsList options_list_arg);
explicit SensitivityStatement(OptionsList options_list_arg);
void checkPass(ModFileStructure& mod_file_struct, WarningConsolidation& warnings) override;
void writeOutput(ostream& output, const string& basename, bool minimal_workspace) const override;
void writeJsonOutput(ostream& output) const override;

View File

@ -161,7 +161,7 @@ str_tolower(string s)
%token EXP LOG LN LOG10 SIN COS TAN ASIN ACOS ATAN SINH COSH TANH ASINH ACOSH ATANH ERF ERFC DIFF ADL AUXILIARY_MODEL_NAME
%token SQRT CBRT NORMCDF NORMPDF STEADY_STATE EXPECTATION
/* GSA analysis */
%token DYNARE_SENSITIVITY MORRIS STAB REDFORM PPRIOR PRIOR_RANGE PPOST ILPTAU MORRIS_NLIV
%token SENSITIVITY DYNARE_SENSITIVITY MORRIS STAB REDFORM PPRIOR PRIOR_RANGE PPOST ILPTAU MORRIS_NLIV
%token MORRIS_NTRA NSAM LOAD_REDFORM LOAD_RMSE LOAD_STAB ALPHA2_STAB LOGTRANS_REDFORM THRESHOLD_REDFORM
%token KSSTAT_REDFORM ALPHA2_REDFORM NAMENDO NAMLAGENDO NAMEXO RMSE LIK_ONLY VAR_RMSE PFILT_RMSE ISTART_RMSE
%token ALPHA_RMSE ALPHA2_RMSE
@ -326,7 +326,7 @@ statement : parameters
| bvar_forecast
| bvar_irf
| sbvar
| dynare_sensitivity
| sensitivity
| homotopy_setup
| forecast
| load_params_and_steady_state
@ -3119,70 +3119,80 @@ ms_estimation : MS_ESTIMATION ';'
{ driver.ms_estimation(); }
;
dynare_sensitivity : DYNARE_SENSITIVITY ';'
{ driver.dynare_sensitivity(); }
| DYNARE_SENSITIVITY '(' dynare_sensitivity_options_list ')' ';'
{ driver.dynare_sensitivity(); }
sensitivity : SENSITIVITY ';'
{ driver.sensitivity(); }
| SENSITIVITY '(' sensitivity_options_list ')' ';'
{ driver.sensitivity(); }
| DYNARE_SENSITIVITY ';'
{
driver.warning("The 'dynare_sensitivity' command is deprecated. It has been renamed 'sensitivity'.");
driver.sensitivity();
}
| DYNARE_SENSITIVITY '(' sensitivity_options_list ')' ';'
{
driver.warning("The 'dynare_sensitivity' command is deprecated. It has been renamed 'sensitivity'.");
driver.sensitivity();
}
;
sensitivity_options_list : sensitivity_option COMMA sensitivity_options_list
| sensitivity_option
;
sensitivity_option : o_gsa_identification
| o_gsa_morris
| o_gsa_stab
| o_gsa_redform
| o_gsa_pprior
| o_gsa_prior_range
| o_gsa_ppost
| o_gsa_ilptau
| o_gsa_morris_nliv
| o_gsa_morris_ntra
| o_gsa_nsam
| o_gsa_load_redform
| o_gsa_load_rmse
| o_gsa_load_stab
| o_gsa_alpha2_stab
| o_gsa_logtrans_redform
| o_gsa_ksstat_redform
| o_gsa_alpha2_redform
| o_gsa_rmse
| o_gsa_lik_only
| o_gsa_pfilt_rmse
| o_gsa_istart_rmse
| o_gsa_alpha_rmse
| o_gsa_alpha2_rmse
| o_gsa_threshold_redform
| o_gsa_namendo
| o_gsa_namexo
| o_gsa_namlagendo
| o_gsa_var_rmse
| o_gsa_neighborhood_width
| o_gsa_pvalue_ks
| o_gsa_pvalue_corr
| o_datafile
| o_nobs
| o_first_obs
| o_prefilter
| o_presample
| o_nograph
| o_nodisplay
| o_graph_format
| o_forecasts_conf_sig
| o_mh_conf_sig
| o_loglinear
| o_mode_file
| o_load_ident_files
| o_useautocorr
| o_ar
| o_kalman_algo
| o_lik_init
| o_diffuse_filter
| o_analytic_derivation
| o_analytic_derivation_mode
;
dynare_sensitivity_options_list : dynare_sensitivity_option COMMA dynare_sensitivity_options_list
| dynare_sensitivity_option
;
dynare_sensitivity_option : o_gsa_identification
| o_gsa_morris
| o_gsa_stab
| o_gsa_redform
| o_gsa_pprior
| o_gsa_prior_range
| o_gsa_ppost
| o_gsa_ilptau
| o_gsa_morris_nliv
| o_gsa_morris_ntra
| o_gsa_nsam
| o_gsa_load_redform
| o_gsa_load_rmse
| o_gsa_load_stab
| o_gsa_alpha2_stab
| o_gsa_logtrans_redform
| o_gsa_ksstat_redform
| o_gsa_alpha2_redform
| o_gsa_rmse
| o_gsa_lik_only
| o_gsa_pfilt_rmse
| o_gsa_istart_rmse
| o_gsa_alpha_rmse
| o_gsa_alpha2_rmse
| o_gsa_threshold_redform
| o_gsa_namendo
| o_gsa_namexo
| o_gsa_namlagendo
| o_gsa_var_rmse
| o_gsa_neighborhood_width
| o_gsa_pvalue_ks
| o_gsa_pvalue_corr
| o_datafile
| o_nobs
| o_first_obs
| o_prefilter
| o_presample
| o_nograph
| o_nodisplay
| o_graph_format
| o_forecasts_conf_sig
| o_mh_conf_sig
| o_loglinear
| o_mode_file
| o_load_ident_files
| o_useautocorr
| o_ar
| o_kalman_algo
| o_lik_init
| o_diffuse_filter
| o_analytic_derivation
| o_analytic_derivation_mode
;
shock_decomposition_options_list : shock_decomposition_option COMMA shock_decomposition_options_list
| shock_decomposition_option
;

View File

@ -155,7 +155,8 @@ DATE -?[0-9]+([ya]|m([1-9]|1[0-2])|q[1-4])
<INITIAL>bvar_density {BEGIN DYNARE_STATEMENT; return token::BVAR_DENSITY; }
<INITIAL>bvar_forecast {BEGIN DYNARE_STATEMENT; return token::BVAR_FORECAST; }
<INITIAL>bvar_irf {BEGIN DYNARE_STATEMENT; return token::BVAR_IRF; }
<INITIAL>dynare_sensitivity {BEGIN DYNARE_STATEMENT; return token::DYNARE_SENSITIVITY;}
<INITIAL>sensitivity {BEGIN DYNARE_STATEMENT; return token::SENSITIVITY;}
<INITIAL>dynare_sensitivity {BEGIN DYNARE_STATEMENT; return token::DYNARE_SENSITIVITY;} // Deprecated
<INITIAL>initval_file {BEGIN DYNARE_STATEMENT; return token::INITVAL_FILE;}
<INITIAL>histval_file {BEGIN DYNARE_STATEMENT; return token::HISTVAL_FILE;}
<INITIAL>forecast {BEGIN DYNARE_STATEMENT; return token::FORECAST;}

View File

@ -2024,9 +2024,9 @@ ParsingDriver::run_estimation(vector<string> symbol_list)
}
void
ParsingDriver::dynare_sensitivity()
ParsingDriver::sensitivity()
{
mod_file->addStatement(make_unique<DynareSensitivityStatement>(move(options_list)));
mod_file->addStatement(make_unique<SensitivityStatement>(move(options_list)));
options_list.clear();
}

View File

@ -592,8 +592,8 @@ public:
void set_corr_options(string name1, string name2, string subsample_name);
//! Runs estimation process
void run_estimation(vector<string> symbol_list);
//! Runs dynare_sensitivy()
void dynare_sensitivity();
//! Runs sensitivity
void sensitivity();
//! Check that no observed variable has yet be defined
void check_varobs();
//! Add a new observed variable