Preprocessor: various provisions for improvements to shock decomposition

Accordingly update the MATLAB routines, the testsuite, and the manual.

In particular, “squeeze_shock_decomp” has been renamed to
“squeeze_shock_decomposition” for consistency with other commands.

Ref. #1687, !1655
parent 1245d841
Pipeline #2690 passed with stages
in 70 minutes and 10 seconds
......@@ -7373,6 +7373,11 @@ Shock Decomposition
If used in combination with :opt:`diff`, the ``diff`` operator is first applied.
Default: not activated
.. option:: max_nrows
Maximum number of rows in the subplot layout of detailed shock
decomposition graphs. Note that columns are always 3. Default: 6
.. command:: initial_condition_decomposition [VARIABLE_NAME]...;
initial_condition_decomposition (OPTIONS...) [VARIABLE_NAME]...;
......@@ -7459,6 +7464,22 @@ Shock Decomposition
If used in combination with :opt:`diff`, the ``diff`` operator is first applied.
Default: not activated
.. command:: squeeze_shock_decomposition [VARIABLE_NAME]...;
|br| For large models, the size of the information stored by shock
decompositions (especially various settings of realtime decompositions) may
become huge. This command allows to squeeze this information in two
possible ways:
* Automatic (default): only the variables for which plotting has been
explicitly required with `plot_shock_decomposition` will have their
decomposition left in `oo_` after this command is run;
* If a list of variables is passed to the command, then only those
variables will have their decomposition left in `oo_` after this
command is run.
Calibrated Smoother
===================
......
......@@ -60,11 +60,7 @@ if isfield(opts_decomp,'init_cond_decomp')
else
init_cond_decomp = 0;
end
if isfield(opts_decomp,'min_nrows')
min_nrows = opts_decomp.min_nrows ;
else
max_nrows = 6;
end
max_nrows = opts_decomp.max_nrows;
screen_shocks = opts_decomp.screen_shocks;
if ~isempty(DynareOptions.plot_shock_decomp.use_shock_groups) || comp_nbr<=18
screen_shocks=0;
......
......@@ -51,6 +51,7 @@ options_.plot_shock_decomp.plot_init_date = options_.initial_condition_decomp.pl
options_.plot_shock_decomp.plot_end_date = options_.initial_condition_decomp.plot_end_date;
options_.plot_shock_decomp.diff = options_.initial_condition_decomp.diff;
options_.plot_shock_decomp.flip = options_.initial_condition_decomp.flip;
options_.plot_shock_decomp.max_nrows = options_.initial_condition_decomp.max_nrows;
if isfield(options_.initial_condition_decomp,'init2shocks') % private trap for uimenu calls
init2shocks=options_.initial_condition_decomp.init2shocks;
......
......@@ -41,4 +41,5 @@ options.initial_condition_decomp.plot_init_date = [];
options.initial_condition_decomp.plot_end_date = [];
options.initial_condition_decomp.diff = false;
options.initial_condition_decomp.flip = false;
options.initial_condition_decomp.max_nrows = 6;
end
......@@ -51,4 +51,5 @@ options.plot_shock_decomp.plot_init_date = [];
options.plot_shock_decomp.plot_end_date = [];
options.plot_shock_decomp.diff = false;
options.plot_shock_decomp.flip = false;
options.plot_shock_decomp.max_nrows = 6;
end
function oo_ = squeeze_shock_decomp(M_,oo_,options_,var_list_)
function oo_ = squeeze_shock_decomposition(M_,oo_,options_,var_list_)
if isfield(oo_,'plot_shock_decomposition_info') && isfield(oo_.plot_shock_decomposition_info','i_var')
my_vars = oo_.plot_shock_decomposition_info.i_var;
......
Subproject commit 031c0cff5fca274ea1e75c70623a8e8be93269bb
Subproject commit c2461981d2917c69c3decfc55bf2aaf006057c52
......@@ -68,7 +68,8 @@
"discretionary_policy" "identification" "bvar_density" "bvar_forecast"
"dynare_sensitivity" "initval_file" "histval_file" "forecast"
"shock_decomposition" "realtime_shock_decomposition"
"plot_shock_decomposition" "initial_condition_decomposition" "sbvar"
"plot_shock_decomposition" "initial_condition_decomposition"
"squeeze_shock_decomposition" "sbvar"
"ms_estimation" "ms_simulation" "ms_compute_mdd" "ms_compute_probabilities"
"ms_forecast" "ms_irf" "ms_variance_decomposition" "conditional_forecast"
"plot_conditional_forecast" "gmm_estimation" "smm_estimation"
......
......@@ -85,7 +85,7 @@ end;
options_.initial_date=dates('1989Q4'); % date arbitrarily set for testing purposes
shock_decomposition(nograph);
// test for nothing to squeeze
oo_ = squeeze_shock_decomp(M_,oo_,options_);
squeeze_shock_decomposition;
// standard plot
plot_shock_decomposition y_obs R_obs pie_obs dq de;
......@@ -112,7 +112,7 @@ close all,
realtime_shock_decomposition(forecast=8, save_realtime=[5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77]) y_obs R_obs pie_obs dq de;
// test squeeze
oo_ = squeeze_shock_decomp(M_,oo_,options_);
squeeze_shock_decomposition;
//realtime pooled
plot_shock_decomposition(realtime = 1) y_obs R_obs pie_obs dq de;
......@@ -157,7 +157,7 @@ close all,
realtime_shock_decomposition(fast_realtime=75) y_obs R_obs pie_obs dq de;
// re-test squeeze
oo_ = squeeze_shock_decomp(M_,oo_,options_);
squeeze_shock_decomposition;
collect_latex_files;
if system(['pdflatex -halt-on-error -interaction=batchmode ' M_.fname '_TeX_binder.tex'])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment