Various provisions for improvements to shock decomposition commands
– New “squeeze_shock_decomposition” command — New “max_nrows” option to “plot_shock_decomposition” and “initial_condition_decomposition” — “plot_shock_decomposition” now returns oo_ as an output argument Ref. dynare#1687, dynare!1655issue#70
parent
031c0cff5f
commit
c2461981d2
|
@ -2811,7 +2811,7 @@ PlotShockDecompositionStatement::writeOutput(ostream &output, const string &base
|
|||
output << "options_ = set_default_plot_shock_decomposition_options(options_);" << endl;
|
||||
options_list.writeOutput(output);
|
||||
symbol_list.writeOutput("var_list_", output);
|
||||
output << "plot_shock_decomposition(M_, oo_, options_, var_list_);" << endl;
|
||||
output << "oo_ = plot_shock_decomposition(M_, oo_, options_, var_list_);" << endl;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2864,6 +2864,35 @@ InitialConditionDecompositionStatement::writeJsonOutput(ostream &output) const
|
|||
output << "}";
|
||||
}
|
||||
|
||||
SqueezeShockDecompositionStatement::SqueezeShockDecompositionStatement(SymbolList symbol_list_arg)
|
||||
: symbol_list{move(symbol_list_arg)}
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SqueezeShockDecompositionStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
|
||||
{
|
||||
if (symbol_list.empty())
|
||||
output << "oo_ = squeeze_shock_decomposition(M_, oo_, options_);" << endl;
|
||||
else
|
||||
{
|
||||
symbol_list.writeOutput("var_list_", output);
|
||||
output << "oo_ = squeeze_shock_decomposition(M_, oo_, options_, var_list_,);" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SqueezeShockDecompositionStatement::writeJsonOutput(ostream &output) const
|
||||
{
|
||||
output << R"({"statementName": "squeeze_shock_decomposition")";
|
||||
if (!symbol_list.empty())
|
||||
{
|
||||
output << ", ";
|
||||
symbol_list.writeJsonOutput(output);
|
||||
}
|
||||
output << "}";
|
||||
}
|
||||
|
||||
ConditionalForecastStatement::ConditionalForecastStatement(OptionsList options_list_arg) :
|
||||
options_list{move(options_list_arg)}
|
||||
{
|
||||
|
|
|
@ -760,6 +760,16 @@ public:
|
|||
void writeJsonOutput(ostream &output) const override;
|
||||
};
|
||||
|
||||
class SqueezeShockDecompositionStatement : public Statement
|
||||
{
|
||||
private:
|
||||
const SymbolList symbol_list;
|
||||
public:
|
||||
SqueezeShockDecompositionStatement(SymbolList symbol_list_arg);
|
||||
void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const override;
|
||||
void writeJsonOutput(ostream &output) const override;
|
||||
};
|
||||
|
||||
class ConditionalForecastStatement : public Statement
|
||||
{
|
||||
private:
|
||||
|
|
|
@ -168,6 +168,7 @@ class ParsingDriver;
|
|||
%token NO_IDENTIFICATION_STRENGTH NO_IDENTIFICATION_REDUCEDFORM NO_IDENTIFICATION_MOMENTS
|
||||
%token NO_IDENTIFICATION_MINIMAL NO_IDENTIFICATION_SPECTRUM NORMALIZE_JACOBIANS GRID_NBR
|
||||
%token TOL_RANK TOL_DERIV TOL_SV CHECKS_VIA_SUBSETS MAX_DIM_SUBSETS_GROUPS
|
||||
%token MAX_NROWS SQUEEZE_SHOCK_DECOMPOSITION
|
||||
|
||||
%token <vector<string>> SYMBOL_VEC
|
||||
|
||||
|
@ -273,6 +274,7 @@ statement : parameters
|
|||
| realtime_shock_decomposition
|
||||
| plot_shock_decomposition
|
||||
| initial_condition_decomposition
|
||||
| squeeze_shock_decomposition
|
||||
| conditional_forecast
|
||||
| conditional_forecast_paths
|
||||
| plot_conditional_forecast
|
||||
|
@ -2452,6 +2454,12 @@ initial_condition_decomposition : INITIAL_CONDITION_DECOMPOSITION ';'
|
|||
{ driver.initial_condition_decomposition(); }
|
||||
;
|
||||
|
||||
squeeze_shock_decomposition : SQUEEZE_SHOCK_DECOMPOSITION ';'
|
||||
{ driver.squeeze_shock_decomposition(); }
|
||||
| SQUEEZE_SHOCK_DECOMPOSITION symbol_list ';'
|
||||
{ driver.squeeze_shock_decomposition(); }
|
||||
;
|
||||
|
||||
bvar_prior_option : o_bvar_prior_tau
|
||||
| o_bvar_prior_decay
|
||||
| o_bvar_prior_lambda
|
||||
|
@ -2862,6 +2870,7 @@ plot_shock_decomposition_option : o_use_shock_groups
|
|||
| o_psd_flip
|
||||
| o_psd_nograph
|
||||
| o_psd_init2shocks
|
||||
| o_psd_max_nrows
|
||||
;
|
||||
|
||||
initial_condition_decomposition_options_list : initial_condition_decomposition_option COMMA initial_condition_decomposition_options_list
|
||||
|
@ -2880,6 +2889,7 @@ initial_condition_decomposition_option : o_icd_type
|
|||
| o_icd_diff
|
||||
| o_icd_flip
|
||||
| o_icd_colormap
|
||||
| o_icd_max_nrows
|
||||
;
|
||||
|
||||
homotopy_setup: HOMOTOPY_SETUP ';' homotopy_list END ';'
|
||||
|
@ -3279,6 +3289,8 @@ o_psd_nodisplay : NODISPLAY { driver.option_num("plot_shock_decomp.nodisplay", "
|
|||
o_psd_init2shocks : INIT2SHOCKS { driver.option_str("plot_shock_decomp.init2shocks", "default"); }
|
||||
| INIT2SHOCKS EQUAL symbol { driver.option_str("plot_shock_decomp.init2shocks", $3); }
|
||||
;
|
||||
o_icd_max_nrows : MAX_NROWS EQUAL INT_NUMBER { driver.option_num("initial_condition_decomp.max_nrows", $3); };
|
||||
o_psd_max_nrows : MAX_NROWS EQUAL INT_NUMBER { driver.option_num("plot_shock_decomp.max_nrows", $3); };
|
||||
o_graph_format : GRAPH_FORMAT EQUAL allowed_graph_formats
|
||||
{ driver.process_graph_format_option(); }
|
||||
| GRAPH_FORMAT EQUAL '(' list_allowed_graph_formats ')'
|
||||
|
|
|
@ -162,6 +162,7 @@ DATE -?[0-9]+([ya]|m([1-9]|1[0-2])|q[1-4]|w([1-9]{1}|[1-4][0-9]|5[0-2]))
|
|||
<INITIAL>realtime_shock_decomposition {BEGIN DYNARE_STATEMENT; return token::REALTIME_SHOCK_DECOMPOSITION;}
|
||||
<INITIAL>plot_shock_decomposition {BEGIN DYNARE_STATEMENT; return token::PLOT_SHOCK_DECOMPOSITION;}
|
||||
<INITIAL>initial_condition_decomposition {BEGIN DYNARE_STATEMENT; return token::INITIAL_CONDITION_DECOMPOSITION;}
|
||||
<INITIAL>squeeze_shock_decomposition {BEGIN DYNARE_STATEMENT; return token::SQUEEZE_SHOCK_DECOMPOSITION;}
|
||||
<INITIAL>sbvar {BEGIN DYNARE_STATEMENT; return token::SBVAR;}
|
||||
<INITIAL>ms_estimation {BEGIN DYNARE_STATEMENT; return token::MS_ESTIMATION;}
|
||||
<INITIAL>ms_simulation {BEGIN DYNARE_STATEMENT; return token::MS_SIMULATION;}
|
||||
|
@ -702,6 +703,7 @@ DATE -?[0-9]+([ya]|m([1-9]|1[0-2])|q[1-4]|w([1-9]{1}|[1-4][0-9]|5[0-2]))
|
|||
<DYNARE_STATEMENT>tol_sv {return token::TOL_SV;}
|
||||
<DYNARE_STATEMENT>checks_via_subsets {return token::CHECKS_VIA_SUBSETS;}
|
||||
<DYNARE_STATEMENT>max_dim_subsets_groups {return token::MAX_DIM_SUBSETS_GROUPS;}
|
||||
<DYNARE_STATEMENT>max_nrows {return token::MAX_NROWS;}
|
||||
|
||||
<DYNARE_STATEMENT>\$[^$]*\$ {
|
||||
strtok(yytext+1, "$");
|
||||
|
|
|
@ -2396,6 +2396,13 @@ ParsingDriver::initial_condition_decomposition()
|
|||
options_list.clear();
|
||||
}
|
||||
|
||||
void
|
||||
ParsingDriver::squeeze_shock_decomposition()
|
||||
{
|
||||
mod_file->addStatement(make_unique<SqueezeShockDecompositionStatement>(symbol_list));
|
||||
symbol_list.clear();
|
||||
}
|
||||
|
||||
void
|
||||
ParsingDriver::conditional_forecast()
|
||||
{
|
||||
|
|
|
@ -702,6 +702,8 @@ public:
|
|||
void plot_shock_decomposition();
|
||||
//! Initial Condition decomposition
|
||||
void initial_condition_decomposition();
|
||||
//! squeeze_shock_decomposition statement
|
||||
void squeeze_shock_decomposition();
|
||||
//! Conditional forecast statement
|
||||
void conditional_forecast();
|
||||
//! Conditional forecast paths block
|
||||
|
|
Loading…
Reference in New Issue