preprocessor: add realtime_shock_decomposition statement. #1406
parent
24abebb0b4
commit
5282e737e7
|
@ -1665,6 +1665,22 @@ ShockDecompositionStatement::writeOutput(ostream &output, const string &basename
|
|||
output << "[oo_,M_]= shock_decomposition(M_,oo_,options_,var_list_,bayestopt_,estim_params_);" << endl;
|
||||
}
|
||||
|
||||
RealtimeShockDecompositionStatement::RealtimeShockDecompositionStatement(const SymbolList &symbol_list_arg,
|
||||
const OptionsList &options_list_arg) :
|
||||
symbol_list(symbol_list_arg),
|
||||
options_list(options_list_arg)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
RealtimeShockDecompositionStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
|
||||
{
|
||||
options_list.writeOutput(output);
|
||||
symbol_list.writeOutput("var_list_", output);
|
||||
output << "oo_ = realtime_shock_decomposition(M_,oo_,options_,var_list_,bayestopt_,estim_params_);" << endl;
|
||||
}
|
||||
|
||||
|
||||
ConditionalForecastStatement::ConditionalForecastStatement(const OptionsList &options_list_arg) :
|
||||
options_list(options_list_arg)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2003-2016 Dynare Team
|
||||
* Copyright (C) 2003-2017 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -586,6 +586,16 @@ public:
|
|||
virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
|
||||
};
|
||||
|
||||
class RealtimeShockDecompositionStatement : public Statement
|
||||
{
|
||||
private:
|
||||
const SymbolList symbol_list;
|
||||
const OptionsList options_list;
|
||||
public:
|
||||
RealtimeShockDecompositionStatement(const SymbolList &symbol_list_arg,
|
||||
const OptionsList &options_list_arg);
|
||||
virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
|
||||
};
|
||||
class ConditionalForecastStatement : public Statement
|
||||
{
|
||||
private:
|
||||
|
|
|
@ -125,7 +125,7 @@ class ParsingDriver;
|
|||
%token RELATIVE_IRF REPLIC SIMUL_REPLIC RPLOT SAVE_PARAMS_AND_STEADY_STATE PARAMETER_UNCERTAINTY
|
||||
%token SHOCKS SHOCK_DECOMPOSITION SHOCK_GROUPS USE_SHOCK_GROUPS SIGMA_E SIMUL SIMUL_ALGO SIMUL_SEED ENDOGENOUS_TERMINAL_PERIOD
|
||||
%token SMOOTHER SMOOTHER2HISTVAL SQUARE_ROOT_SOLVER STACK_SOLVE_ALGO STEADY_STATE_MODEL SOLVE_ALGO SOLVER_PERIODS ROBUST_LIN_SOLVE
|
||||
%token STDERR STEADY STOCH_SIMUL SURPRISE SYLVESTER SYLVESTER_FIXED_POINT_TOL REGIMES REGIME
|
||||
%token STDERR STEADY STOCH_SIMUL SURPRISE SYLVESTER SYLVESTER_FIXED_POINT_TOL REGIMES REGIME REALTIME_SHOCK_DECOMPOSITION
|
||||
%token TEX RAMSEY_MODEL RAMSEY_POLICY RAMSEY_CONSTRAINTS PLANNER_DISCOUNT DISCRETIONARY_POLICY DISCRETIONARY_TOL
|
||||
%token <string_val> TEX_NAME
|
||||
%token UNIFORM_PDF UNIT_ROOT_VARS USE_DLL USEAUTOCORR GSA_SAMPLE_FILE USE_UNIVARIATE_FILTERS_IF_SINGULARITY_IS_DETECTED
|
||||
|
@ -171,7 +171,7 @@ class ParsingDriver;
|
|||
%token ADAPTIVE_MH_DRAWS THINNING_FACTOR COEFFICIENTS_PRIOR_HYPERPARAMETERS
|
||||
%token CONVERGENCE_STARTING_VALUE CONVERGENCE_ENDING_VALUE CONVERGENCE_INCREMENT_VALUE
|
||||
%token MAX_ITERATIONS_STARTING_VALUE MAX_ITERATIONS_INCREMENT_VALUE MAX_BLOCK_ITERATIONS
|
||||
%token MAX_REPEATED_OPTIMIZATION_RUNS FUNCTION_CONVERGENCE_CRITERION
|
||||
%token MAX_REPEATED_OPTIMIZATION_RUNS FUNCTION_CONVERGENCE_CRITERION SAVE_REALTIME
|
||||
%token PARAMETER_CONVERGENCE_CRITERION NUMBER_OF_LARGE_PERTURBATIONS NUMBER_OF_SMALL_PERTURBATIONS
|
||||
%token NUMBER_OF_POSTERIOR_DRAWS_AFTER_PERTURBATION MAX_NUMBER_OF_STAGES
|
||||
%token RANDOM_FUNCTION_CONVERGENCE_CRITERION RANDOM_PARAMETER_CONVERGENCE_CRITERION
|
||||
|
@ -261,6 +261,7 @@ statement : parameters
|
|||
| write_latex_static_model
|
||||
| write_latex_original_model
|
||||
| shock_decomposition
|
||||
| realtime_shock_decomposition
|
||||
| conditional_forecast
|
||||
| conditional_forecast_paths
|
||||
| plot_conditional_forecast
|
||||
|
@ -2128,6 +2129,16 @@ shock_decomposition : SHOCK_DECOMPOSITION ';'
|
|||
{ driver.shock_decomposition(); }
|
||||
;
|
||||
|
||||
realtime_shock_decomposition : REALTIME_SHOCK_DECOMPOSITION ';'
|
||||
{driver.realtime_shock_decomposition(); }
|
||||
| REALTIME_SHOCK_DECOMPOSITION '(' realtime_shock_decomposition_options_list ')' ';'
|
||||
{ driver.realtime_shock_decomposition(); }
|
||||
| REALTIME_SHOCK_DECOMPOSITION symbol_list ';'
|
||||
{ driver.realtime_shock_decomposition(); }
|
||||
| REALTIME_SHOCK_DECOMPOSITION '(' realtime_shock_decomposition_options_list ')' symbol_list ';'
|
||||
{ driver.realtime_shock_decomposition(); }
|
||||
;
|
||||
|
||||
bvar_prior_option : o_bvar_prior_tau
|
||||
| o_bvar_prior_decay
|
||||
| o_bvar_prior_lambda
|
||||
|
@ -2497,6 +2508,22 @@ shock_decomposition_option : o_parameter_set
|
|||
| o_init_state
|
||||
;
|
||||
|
||||
realtime_shock_decomposition_options_list : realtime_shock_decomposition_option COMMA realtime_shock_decomposition_options_list
|
||||
| realtime_shock_decomposition_option
|
||||
;
|
||||
|
||||
realtime_shock_decomposition_option : o_parameter_set
|
||||
| o_datafile
|
||||
| o_first_obs
|
||||
| o_nobs
|
||||
| o_use_shock_groups
|
||||
| o_colormap
|
||||
| o_shock_decomposition_nograph
|
||||
| o_shock_decomposition_presample
|
||||
| o_shock_decomposition_forecast
|
||||
| o_save_realtime
|
||||
;
|
||||
|
||||
homotopy_setup: HOMOTOPY_SETUP ';' homotopy_list END ';'
|
||||
{ driver.end_homotopy();};
|
||||
|
||||
|
@ -2834,6 +2861,9 @@ o_posterior_nograph : POSTERIOR_NOGRAPH
|
|||
;
|
||||
o_shock_decomposition_nograph : NOGRAPH { driver.option_num("no_graph.shock_decomposition", "1"); }
|
||||
o_init_state : INIT_STATE EQUAL INT_NUMBER { driver.option_num("shock_decomp.init_state", $3); };
|
||||
o_shock_decomposition_presample : PRESAMPLE EQUAL INT_NUMBER { driver.option_num("shock_decomp.presample", $3); };
|
||||
o_shock_decomposition_forecast : FORECAST EQUAL INT_NUMBER { driver.option_num("shock_decomp.forecast", $3); };
|
||||
o_save_realtime : SAVE_REALTIME EQUAL vec_int { driver.option_vec_int("shock_decomp.save_realtime", $3); };
|
||||
o_nodisplay : NODISPLAY { driver.option_num("nodisplay","1"); };
|
||||
o_graph_format : GRAPH_FORMAT EQUAL allowed_graph_formats
|
||||
{ driver.process_graph_format_option(); }
|
||||
|
|
|
@ -150,6 +150,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
|
|||
<INITIAL>histval_file {BEGIN DYNARE_STATEMENT; return token::HISTVAL_FILE;}
|
||||
<INITIAL>forecast {BEGIN DYNARE_STATEMENT; return token::FORECAST;}
|
||||
<INITIAL>shock_decomposition {BEGIN DYNARE_STATEMENT; return token::SHOCK_DECOMPOSITION;}
|
||||
<INITIAL>realtime_shock_decomposition {BEGIN DYNARE_STATEMENT; return token::REALTIME_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;}
|
||||
|
@ -571,6 +572,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>controlled_varexo {return token::CONTROLLED_VAREXO; }
|
||||
<DYNARE_STATEMENT>parameter_set {return token::PARAMETER_SET; }
|
||||
<DYNARE_STATEMENT>init_state {return token::INIT_STATE; }
|
||||
<DYNARE_STATEMENT>save_realtime {return token::SAVE_REALTIME;}
|
||||
<DYNARE_STATEMENT>prior_mode {return token::PRIOR_MODE; }
|
||||
<DYNARE_STATEMENT>prior_mean {return token::PRIOR_MEAN; }
|
||||
<DYNARE_STATEMENT>posterior_mode {return token::POSTERIOR_MODE; }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2003-2016 Dynare Team
|
||||
* Copyright (C) 2003-2017 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -2125,6 +2125,14 @@ ParsingDriver::shock_decomposition()
|
|||
options_list.clear();
|
||||
}
|
||||
|
||||
void
|
||||
ParsingDriver::realtime_shock_decomposition()
|
||||
{
|
||||
mod_file->addStatement(new RealtimeShockDecompositionStatement(symbol_list, options_list));
|
||||
symbol_list.clear();
|
||||
options_list.clear();
|
||||
}
|
||||
|
||||
void
|
||||
ParsingDriver::conditional_forecast()
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2003-2016 Dynare Team
|
||||
* Copyright (C) 2003-2017 Dynare Team
|
||||
*
|
||||
* This file is part of Dynare.
|
||||
*
|
||||
|
@ -590,6 +590,8 @@ public:
|
|||
void markov_switching();
|
||||
//! Shock decomposition
|
||||
void shock_decomposition();
|
||||
//! Realtime Shock decomposition
|
||||
void realtime_shock_decomposition();
|
||||
//! Conditional forecast statement
|
||||
void conditional_forecast();
|
||||
//! Conditional forecast paths block
|
||||
|
|
|
@ -94,9 +94,7 @@ close all,
|
|||
|
||||
// testing realtime decomposition
|
||||
// first compute realtime decompositions [pre-processor not yet available]
|
||||
options_.shock_decomp.forecast=8;
|
||||
options_.shock_decomp.save_realtime = [5:4:options_.nobs]; % store values useful for annualized vars
|
||||
oo_ = realtime_shock_decomposition(M_,oo_,options_,var_list_,bayestopt_,estim_params_);
|
||||
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]);
|
||||
|
||||
options_.shock_decomp.detail_plot = 0;
|
||||
options_.shock_decomp.type='';
|
||||
|
|
Loading…
Reference in New Issue