Merge branch 'master' into json

issue#70
Stéphane Adjemian (Charybdis) 2017-06-16 20:03:36 +02:00
commit 7af01dd0a2
28 changed files with 378 additions and 72 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2007-2015 Dynare Team
* Copyright (C) 2007-2017 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -2325,15 +2325,16 @@ IdentificationStatement::writeJsonOutput(ostream &output) const
output << "}";
}
WriteLatexDynamicModelStatement::WriteLatexDynamicModelStatement(const DynamicModel &dynamic_model_arg) :
dynamic_model(dynamic_model_arg)
WriteLatexDynamicModelStatement::WriteLatexDynamicModelStatement(const DynamicModel &dynamic_model_arg, bool write_equation_tags_arg) :
dynamic_model(dynamic_model_arg),
write_equation_tags(write_equation_tags_arg)
{
}
void
WriteLatexDynamicModelStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
{
dynamic_model.writeLatexFile(basename);
dynamic_model.writeLatexFile(basename, write_equation_tags);
}
void
@ -2408,6 +2409,53 @@ ShockDecompositionStatement::writeJsonOutput(ostream &output) const
output << "}";
}
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;
}
PlotShockDecompositionStatement::PlotShockDecompositionStatement(const SymbolList &symbol_list_arg,
const OptionsList &options_list_arg) :
symbol_list(symbol_list_arg),
options_list(options_list_arg)
{
}
void
PlotShockDecompositionStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
{
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;
}
InitialConditionDecompositionStatement::InitialConditionDecompositionStatement(const SymbolList &symbol_list_arg,
const OptionsList &options_list_arg) :
symbol_list(symbol_list_arg),
options_list(options_list_arg)
{
}
void
InitialConditionDecompositionStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
{
output << "options_ = set_default_initial_condition_decomposition_options(options_);" << endl;
options_list.writeOutput(output);
symbol_list.writeOutput("var_list_", output);
output << "initial_condition_decomposition(M_, oo_, options_, var_list_, bayestopt_, estim_params_);" << endl;
}
ConditionalForecastStatement::ConditionalForecastStatement(const OptionsList &options_list_arg) :
options_list(options_list_arg)
{
@ -4300,7 +4348,7 @@ CalibSmootherStatement::writeOutput(ostream &output, const string &basename, boo
symbol_list.writeOutput("var_list_", output);
output << "options_.smoother = 1;" << endl;
output << "options_.order = 1;" << endl;
output << "[oo_,options_,bayestopt_]=evaluate_smoother('calibration',var_list_,M_,oo_,options_,bayestopt_,estim_params_);" << endl;
output << "[oo_,M_,options_,bayestopt_]=evaluate_smoother('calibration',var_list_,M_,oo_,options_,bayestopt_,estim_params_);" << endl;
}
void

View File

@ -598,8 +598,9 @@ class WriteLatexDynamicModelStatement : public Statement
{
private:
const DynamicModel &dynamic_model;
const bool write_equation_tags;
public:
WriteLatexDynamicModelStatement(const DynamicModel &dynamic_model_arg);
WriteLatexDynamicModelStatement(const DynamicModel &dynamic_model_arg, bool write_equation_tags_arg);
virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
virtual void writeJsonOutput(ostream &output) const;
};
@ -636,6 +637,39 @@ public:
virtual void writeJsonOutput(ostream &output) 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 PlotShockDecompositionStatement : public Statement
{
private:
const SymbolList symbol_list;
const OptionsList options_list;
public:
PlotShockDecompositionStatement(const SymbolList &symbol_list_arg,
const OptionsList &options_list_arg);
virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
};
class InitialConditionDecompositionStatement : public Statement
{
private:
const SymbolList symbol_list;
const OptionsList options_list;
public:
InitialConditionDecompositionStatement(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:

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2016 Dynare Team
* Copyright (C) 2010-2017 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2016 Dynare Team
* Copyright (C) 2010-2017 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2016 Dynare Team
* Copyright (C) 2003-2017 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -2002,6 +2002,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
mDynamicModelFile << " tmp = y(:,M_.block_structure.block(" << block + 1 << ").variable);\n";
mDynamicModelFile << " if any(isnan(tmp) | isinf(tmp))\n";
mDynamicModelFile << " disp(['Inf or Nan value during the evaluation of block " << block <<"']);\n";
mDynamicModelFile << " oo_.deterministic_simulation.status = 0;\n";
mDynamicModelFile << " oo_.deterministic_simulation.error = 100;\n";
mDynamicModelFile << " varargout{1} = oo_;\n";
mDynamicModelFile << " return;\n";
@ -2029,6 +2030,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
mDynamicModelFile << " tmp = y(:,M_.block_structure.block(" << block + 1 << ").variable);\n";
mDynamicModelFile << " if any(isnan(tmp) | isinf(tmp))\n";
mDynamicModelFile << " disp(['Inf or Nan value during the evaluation of block " << block <<"']);\n";
mDynamicModelFile << " oo_.deterministic_simulation.status = 0;\n";
mDynamicModelFile << " oo_.deterministic_simulation.error = 100;\n";
mDynamicModelFile << " varargout{1} = oo_;\n";
mDynamicModelFile << " return;\n";
@ -2060,6 +2062,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
mDynamicModelFile << " tmp = y(:,M_.block_structure.block(" << block + 1 << ").variable);\n";
mDynamicModelFile << " if any(isnan(tmp) | isinf(tmp))\n";
mDynamicModelFile << " disp(['Inf or Nan value during the resolution of block " << block <<"']);\n";
mDynamicModelFile << " oo_.deterministic_simulation.status = 0;\n";
mDynamicModelFile << " oo_.deterministic_simulation.error = 100;\n";
mDynamicModelFile << " varargout{1} = oo_;\n";
mDynamicModelFile << " return;\n";
@ -2092,6 +2095,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
mDynamicModelFile << " tmp = y(:,M_.block_structure.block(" << block + 1 << ").variable);\n";
mDynamicModelFile << " if any(isnan(tmp) | isinf(tmp))\n";
mDynamicModelFile << " disp(['Inf or Nan value during the resolution of block " << block <<"']);\n";
mDynamicModelFile << " oo_.deterministic_simulation.status = 0;\n";
mDynamicModelFile << " oo_.deterministic_simulation.error = 100;\n";
mDynamicModelFile << " varargout{1} = oo_;\n";
mDynamicModelFile << " return;\n";
@ -2124,6 +2128,7 @@ DynamicModel::writeSparseDynamicMFile(const string &dynamic_basename, const stri
mDynamicModelFile << " tmp = y(:,M_.block_structure.block(" << block + 1 << ").variable);\n";
mDynamicModelFile << " if any(isnan(tmp) | isinf(tmp))\n";
mDynamicModelFile << " disp(['Inf or Nan value during the resolution of block " << block <<"']);\n";
mDynamicModelFile << " oo_.deterministic_simulation.status = 0;\n";
mDynamicModelFile << " oo_.deterministic_simulation.error = 100;\n";
mDynamicModelFile << " varargout{1} = oo_;\n";
mDynamicModelFile << " return;\n";
@ -4097,11 +4102,11 @@ DynamicModel::testTrendDerivativesEqualToZero(const eval_context_t &eval_context
double nearZero = testeq->getDerivative(endogit->second)->eval(eval_context); // eval d F / d Trend d Endog
if (fabs(nearZero) > ZERO_BAND)
{
cerr << "ERROR: trends not compatible with balanced growth path; the second-order cross partial of equation " << eq + 1 << " (line "
cerr << "WARNING: trends not compatible with balanced growth path; the second-order cross partial of equation " << eq + 1 << " (line "
<< equations_lineno[eq] << ") w.r.t. trend variable "
<< symbol_table.getName(it->first.first) << " and endogenous variable "
<< symbol_table.getName(endogit->first.first) << " is not null. " << endl;
exit(EXIT_FAILURE);
// Changed to warning. See discussion in #1389
}
}
}
@ -4371,9 +4376,9 @@ DynamicModel::writeChainRuleDerivative(ostream &output, int eqr, int varr, int l
}
void
DynamicModel::writeLatexFile(const string &basename) const
DynamicModel::writeLatexFile(const string &basename, const bool write_equation_tags) const
{
writeLatexModelFile(basename + "_dynamic", oLatexDynamicModel);
writeLatexModelFile(basename + "_dynamic", oLatexDynamicModel, write_equation_tags);
}
void

View File

@ -290,7 +290,7 @@ public:
size_t dynamicOnlyEquationsNbr() const;
//! Writes LaTeX file with the equations of the dynamic model
void writeLatexFile(const string &basename) const;
void writeLatexFile(const string &basename, const bool write_equation_tags) const;
//! Writes LaTeX file with the equations of the dynamic model (for the original model)
void writeLatexOriginalFile(const string &basename) const;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2016 Dynare Team
* Copyright (C) 2003-2017 Dynare Team
*
* This file is part of Dynare.
*
@ -86,12 +86,12 @@ class ParsingDriver;
%token AIM_SOLVER ANALYTIC_DERIVATION ANALYTIC_DERIVATION_MODE AR AUTOCORR POSTERIOR_SAMPLING_METHOD
%token BAYESIAN_IRF BETA_PDF BLOCK USE_CALIBRATION SILENT_OPTIMIZER
%token BVAR_DENSITY BVAR_FORECAST NODECOMPOSITION DR_DISPLAY_TOL HUGE_NUMBER
%token BVAR_PRIOR_DECAY BVAR_PRIOR_FLAT BVAR_PRIOR_LAMBDA
%token BVAR_PRIOR_MU BVAR_PRIOR_OMEGA BVAR_PRIOR_TAU BVAR_PRIOR_TRAIN
%token BVAR_REPLIC BYTECODE ALL_VALUES_REQUIRED PROPOSAL_DISTRIBUTION
%token BVAR_DENSITY BVAR_FORECAST NODECOMPOSITION DR_DISPLAY_TOL HUGE_NUMBER FIG_NAME WRITE_XLS
%token BVAR_PRIOR_DECAY BVAR_PRIOR_FLAT BVAR_PRIOR_LAMBDA INTERACTIVE SCREEN_SHOCKS STEADYSTATE
%token BVAR_PRIOR_MU BVAR_PRIOR_OMEGA BVAR_PRIOR_TAU BVAR_PRIOR_TRAIN DETAIL_PLOT TYPE
%token BVAR_REPLIC BYTECODE ALL_VALUES_REQUIRED PROPOSAL_DISTRIBUTION REALTIME VINTAGE
%token CALIB_SMOOTHER CHANGE_TYPE CHECK CONDITIONAL_FORECAST CONDITIONAL_FORECAST_PATHS CONF_SIG CONSTANT CONTROLLED_VAREXO CORR COVAR CUTOFF CYCLE_REDUCTION LOGARITHMIC_REDUCTION
%token CONSIDER_ALL_ENDOGENOUS CONSIDER_ONLY_OBSERVED
%token CONSIDER_ALL_ENDOGENOUS CONSIDER_ONLY_OBSERVED INITIAL_CONDITION_DECOMPOSITION
%token DATAFILE FILE SERIES DOUBLING DR_CYCLE_REDUCTION_TOL DR_LOGARITHMIC_REDUCTION_TOL DR_LOGARITHMIC_REDUCTION_MAXITER DR_ALGO DROP DSAMPLE DYNASAVE DYNATYPE CALIBRATION DIFFERENTIATE_FORWARD_VARS
%token END ENDVAL EQUAL ESTIMATION ESTIMATED_PARAMS ESTIMATED_PARAMS_BOUNDS ESTIMATED_PARAMS_INIT EXTENDED_PATH ENDOGENOUS_PRIOR
%token FILENAME DIRNAME FILTER_STEP_AHEAD FILTERED_VARS FIRST_OBS LAST_OBS SET_TIME OSR_PARAMS_BOUNDS KEEP_KALMAN_ALGO_IF_SINGULARITY_IS_DETECTED
@ -103,17 +103,17 @@ class ParsingDriver;
%token IDENTIFICATION INF_CONSTANT INITVAL INITVAL_FILE BOUNDS JSCALE INIT INFILE INVARS
%token <string_val> INT_NUMBER
%token INV_GAMMA_PDF INV_GAMMA1_PDF INV_GAMMA2_PDF IRF IRF_SHOCKS IRF_PLOT_THRESHOLD IRF_CALIBRATION
%token FAST_KALMAN_FILTER KALMAN_ALGO KALMAN_TOL DIFFUSE_KALMAN_TOL SUBSAMPLES OPTIONS TOLF TOLX
%token FAST_KALMAN_FILTER KALMAN_ALGO KALMAN_TOL DIFFUSE_KALMAN_TOL SUBSAMPLES OPTIONS TOLF TOLX PLOT_INIT_DATE PLOT_END_DATE
%token LAPLACE LIK_ALGO LIK_INIT LINEAR LOAD_IDENT_FILES LOAD_MH_FILE LOAD_RESULTS_AFTER_LOAD_MH LOAD_PARAMS_AND_STEADY_STATE LOGLINEAR LOGDATA LYAPUNOV LINEAR_APPROXIMATION
%token LYAPUNOV_FIXED_POINT_TOL LYAPUNOV_DOUBLING_TOL LYAPUNOV_SQUARE_ROOT_SOLVER_TOL LOG_DEFLATOR LOG_TREND_VAR LOG_GROWTH_FACTOR MARKOWITZ MARGINAL_DENSITY MAX MAXIT
%token MFS MH_CONF_SIG MH_DROP MH_INIT_SCALE MH_JSCALE MH_MODE MH_NBLOCKS MH_REPLIC MH_RECOVER POSTERIOR_MAX_SUBSAMPLE_DRAWS MIN MINIMAL_SOLVING_PERIODS
%token MODE_CHECK MODE_CHECK_NEIGHBOURHOOD_SIZE MODE_CHECK_SYMMETRIC_PLOTS MODE_CHECK_NUMBER_OF_POINTS MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MODEL_INFO MSHOCKS ABS SIGN
%token MODEL_DIAGNOSTICS MODIFIEDHARMONICMEAN MOMENTS_VARENDO CONTEMPORANEOUS_CORRELATION DIFFUSE_FILTER SUB_DRAWS TAPER_STEPS GEWEKE_INTERVAL RAFTERY_LEWIS_QRS RAFTERY_LEWIS_DIAGNOSTICS MCMC_JUMPING_COVARIANCE MOMENT_CALIBRATION
%token NUMBER_OF_PARTICLES RESAMPLING SYSTEMATIC GENERIC RESAMPLING_THRESHOLD RESAMPLING_METHOD KITAGAWA STRATIFIED SMOOTH
%token CPF_WEIGHTS AMISANOTRISTANI MURRAYJONESPARSLOW
%token FILTER_ALGORITHM PROPOSAL_APPROXIMATION CUBATURE UNSCENTED MONTECARLO DISTRIBUTION_APPROXIMATION
%token CPF_WEIGHTS AMISANOTRISTANI MURRAYJONESPARSLOW WRITE_EQUATION_TAGS
%token NONLINEAR_FILTER_INITIALIZATION FILTER_ALGORITHM PROPOSAL_APPROXIMATION CUBATURE UNSCENTED MONTECARLO DISTRIBUTION_APPROXIMATION
%token <string_val> NAME
%token USE_PENALIZED_OBJECTIVE_FOR_HESSIAN
%token USE_PENALIZED_OBJECTIVE_FOR_HESSIAN INIT_STATE RESCALE_PREDICTION_ERROR_COVARIANCE
%token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NODISPLAY NOCORR NODIAGNOSTIC NOFUNCTIONS NO_HOMOTOPY
%token NOGRAPH POSTERIOR_NOGRAPH POSTERIOR_GRAPH NOMOMENTS NOPRINT NORMAL_PDF SAVE_DRAWS
%token OBSERVATION_TRENDS OPTIM OPTIM_WEIGHTS ORDER OSR OSR_PARAMS MAX_DIM_COVA_GROUP ADVANCED OUTFILE OUTVARS OVERWRITE
@ -125,13 +125,13 @@ 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
%token VALUES VAR VAREXO VAREXO_DET VAROBS PREDETERMINED_VARIABLES
%token VALUES VAR VAREXO VAREXO_DET VAROBS PREDETERMINED_VARIABLES PLOT_SHOCK_DECOMPOSITION
%token WRITE_LATEX_DYNAMIC_MODEL WRITE_LATEX_STATIC_MODEL WRITE_LATEX_ORIGINAL_MODEL
%token XLS_SHEET XLS_RANGE LMMCP OCCBIN BANDPASS_FILTER COLORMAP
%token XLS_SHEET XLS_RANGE LMMCP OCCBIN BANDPASS_FILTER COLORMAP QOQ YOY AOA
%left COMMA
%left EQUAL_EQUAL EXCLAMATION_EQUAL
%left LESS GREATER LESS_EQUAL GREATER_EQUAL
@ -143,7 +143,7 @@ class ParsingDriver;
%token ASINH ACOSH ATANH SQRT NORMCDF NORMPDF STEADY_STATE EXPECTATION
/* GSA analysis */
%token DYNARE_SENSITIVITY MORRIS STAB REDFORM PPRIOR PRIOR_RANGE PPOST ILPTAU MORRIS_NLIV
%token MORRIS_NTRA NSAM LOAD_REDFORM LOAD_RMSE LOAD_STAB ALPHA2_STAB KSSTAT LOGTRANS_REDFORM THRESHOLD_REDFORM
%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
/* end of GSA analysis*/
@ -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,9 @@ statement : parameters
| write_latex_static_model
| write_latex_original_model
| shock_decomposition
| realtime_shock_decomposition
| plot_shock_decomposition
| initial_condition_decomposition
| conditional_forecast
| conditional_forecast_paths
| plot_conditional_forecast
@ -1815,6 +1818,7 @@ estimation_options : o_datafile
| o_resampling_threshold
| o_resampling_method
| o_filter_algorithm
| o_nonlinear_filter_initialization
| o_cpf_weights
| o_proposal_approximation
| o_distribution_approximation
@ -1827,6 +1831,7 @@ estimation_options : o_datafile
| o_posterior_sampler_options
| o_keep_kalman_algo_if_singularity_is_detected
| o_use_penalized_objective_for_hessian
| o_rescale_prediction_error_covariance
;
list_optim_option : QUOTED_STRING COMMA QUOTED_STRING
@ -2107,7 +2112,9 @@ ramsey_policy_options : stoch_simul_primary_options
;
write_latex_dynamic_model : WRITE_LATEX_DYNAMIC_MODEL ';'
{ driver.write_latex_dynamic_model(); }
{ driver.write_latex_dynamic_model(false); }
| WRITE_LATEX_DYNAMIC_MODEL '(' WRITE_EQUATION_TAGS ')' ';'
{ driver.write_latex_dynamic_model(true); }
;
write_latex_static_model : WRITE_LATEX_STATIC_MODEL ';'
@ -2128,6 +2135,36 @@ 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(); }
;
plot_shock_decomposition : PLOT_SHOCK_DECOMPOSITION ';'
{driver.plot_shock_decomposition(); }
| PLOT_SHOCK_DECOMPOSITION '(' plot_shock_decomposition_options_list ')' ';'
{ driver.plot_shock_decomposition(); }
| PLOT_SHOCK_DECOMPOSITION symbol_list ';'
{ driver.plot_shock_decomposition(); }
| PLOT_SHOCK_DECOMPOSITION '(' plot_shock_decomposition_options_list ')' symbol_list ';'
{ driver.plot_shock_decomposition(); }
;
initial_condition_decomposition : INITIAL_CONDITION_DECOMPOSITION ';'
{driver.initial_condition_decomposition(); }
| INITIAL_CONDITION_DECOMPOSITION '(' initial_condition_decomposition_options_list ')' ';'
{ driver.initial_condition_decomposition(); }
| INITIAL_CONDITION_DECOMPOSITION symbol_list ';'
{ driver.initial_condition_decomposition(); }
| INITIAL_CONDITION_DECOMPOSITION '(' initial_condition_decomposition_options_list ')' symbol_list ';'
{ driver.initial_condition_decomposition(); }
;
bvar_prior_option : o_bvar_prior_tau
| o_bvar_prior_decay
| o_bvar_prior_lambda
@ -2444,7 +2481,6 @@ dynare_sensitivity_option : o_gsa_identification
| o_gsa_load_rmse
| o_gsa_load_stab
| o_gsa_alpha2_stab
| o_gsa_ksstat
| o_gsa_logtrans_redform
| o_gsa_ksstat_redform
| o_gsa_alpha2_redform
@ -2494,8 +2530,58 @@ shock_decomposition_option : o_parameter_set
| o_shock_decomposition_nograph
| o_first_obs
| o_nobs
| 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
;
plot_shock_decomposition_options_list : plot_shock_decomposition_option COMMA plot_shock_decomposition_options_list
| plot_shock_decomposition_option
;
plot_shock_decomposition_option : o_psd_use_shock_groups
| o_psd_colormap
| o_psd_nodisplay
| o_psd_graph_format
| o_psd_detail_plot
| o_psd_interactive
| o_psd_screen_shocks
| o_psd_steadystate
| o_psd_type
| o_psd_fig_name
| o_psd_write_xls
| o_psd_realtime
| o_psd_vintage
| o_psd_plot_init_date
| o_psd_plot_end_date
;
initial_condition_decomposition_options_list : initial_condition_decomposition_option COMMA initial_condition_decomposition_options_list
| initial_condition_decomposition_option
;
initial_condition_decomposition_option : o_icd_type
| o_icd_detail_plot
| o_icd_steadystate
| o_icd_write_xls
| o_icd_plot_init_date
| o_icd_plot_end_date
;
homotopy_setup: HOMOTOPY_SETUP ';' homotopy_list END ';'
{ driver.end_homotopy();};
@ -2832,12 +2918,22 @@ o_posterior_nograph : POSTERIOR_NOGRAPH
{ driver.option_num("no_graph.posterior", "0"); }
;
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_psd_nodisplay : NODISPLAY { driver.option_num("plot_shock_decomp.nodisplay","1"); };
o_graph_format : GRAPH_FORMAT EQUAL allowed_graph_formats
{ driver.process_graph_format_option(); }
| GRAPH_FORMAT EQUAL '(' list_allowed_graph_formats ')'
{ driver.process_graph_format_option(); }
;
o_psd_graph_format : GRAPH_FORMAT EQUAL allowed_graph_formats
{ driver.plot_shock_decomp_process_graph_format_option(); }
| GRAPH_FORMAT EQUAL '(' list_allowed_graph_formats ')'
{ driver.plot_shock_decomp_process_graph_format_option(); }
;
allowed_graph_formats : EPS
{ driver.add_graph_format("eps"); }
| FIG
@ -2943,7 +3039,35 @@ o_dr : DR EQUAL CYCLE_REDUCTION {driver.option_num("dr_cycle_reduction", "1"); }
o_dr_cycle_reduction_tol : DR_CYCLE_REDUCTION_TOL EQUAL non_negative_number {driver.option_num("dr_cycle_reduction_tol",$3);};
o_dr_logarithmic_reduction_tol : DR_LOGARITHMIC_REDUCTION_TOL EQUAL non_negative_number {driver.option_num("dr_logarithmic_reduction_tol",$3);};
o_dr_logarithmic_reduction_maxiter : DR_LOGARITHMIC_REDUCTION_MAXITER EQUAL INT_NUMBER {driver.option_num("dr_logarithmic_reduction_maxiter",$3);};
o_psd_detail_plot : DETAIL_PLOT { driver.option_num("plot_shock_decomp.detail_plot", "1"); };
o_icd_detail_plot : DETAIL_PLOT { driver.option_num("initial_condition_decomp.detail_plot", "1"); };
o_psd_interactive : INTERACTIVE { driver.option_num("plot_shock_decomp.interactive", "1"); };
o_psd_screen_shocks : SCREEN_SHOCKS { driver.option_num("plot_shock_decomp.screen_shocks", "1"); };
o_psd_steadystate : STEADYSTATE { driver.option_num("plot_shock_decomp.steadystate", "1"); };
o_icd_steadystate : STEADYSTATE { driver.option_num("initial_condition_decomp.steadystate", "1"); };
o_psd_fig_name : FIG_NAME EQUAL filename { driver.option_str("plot_shock_decomp.fig_name", $3); };
o_psd_type : TYPE EQUAL QOQ
{ driver.option_str("plot_shock_decomp.type", "qoq"); }
| TYPE EQUAL YOY
{ driver.option_str("plot_shock_decomp.type", "qoq"); }
| TYPE EQUAL AOA
{ driver.option_str("plot_shock_decomp.type", "qoq"); }
;
o_icd_type : TYPE EQUAL QOQ
{ driver.option_str("initial_condition_decomp.type", "qoq"); }
| TYPE EQUAL YOY
{ driver.option_str("initial_condition_decomp.type", "qoq"); }
| TYPE EQUAL AOA
{ driver.option_str("initial_condition_decomp.type", "qoq"); }
;
o_icd_plot_init_date : PLOT_INIT_DATE EQUAL date_expr { driver.option_date("initial_condition_decomp.plot_init_date", $3); } ;
o_icd_plot_end_date : PLOT_END_DATE EQUAL date_expr { driver.option_date("initial_condition_decomp.plot_end_date", $3); } ;
o_psd_plot_init_date : PLOT_INIT_DATE EQUAL date_expr { driver.option_date("plot_shock_decomp.plot_init_date", $3); } ;
o_psd_plot_end_date : PLOT_END_DATE EQUAL date_expr { driver.option_date("plot_shock_decomp.plot_end_date", $3); } ;
o_icd_write_xls : WRITE_XLS { driver.option_num("initial_condition_decomp.write_xls", "1"); };
o_psd_write_xls : WRITE_XLS { driver.option_num("plot_shock_decomp.write_xls", "1"); };
o_psd_realtime : REALTIME EQUAL INT_NUMBER { driver.option_num("plot_shock_decomp.realtime", $3); };
o_psd_vintage : VINTAGE EQUAL INT_NUMBER { driver.option_num("plot_shock_decomp.vintage", $3); };
o_bvar_prior_tau : BVAR_PRIOR_TAU EQUAL signed_number { driver.option_num("bvar_prior_tau", $3); };
o_bvar_prior_decay : BVAR_PRIOR_DECAY EQUAL non_negative_number { driver.option_num("bvar_prior_decay", $3); };
o_bvar_prior_lambda : BVAR_PRIOR_LAMBDA EQUAL signed_number { driver.option_num("bvar_prior_lambda", $3); };
@ -2964,6 +3088,7 @@ o_resampling_method : RESAMPLING_METHOD EQUAL KITAGAWA {driver.option_num("parti
o_cpf_weights : CPF_WEIGHTS EQUAL AMISANOTRISTANI {driver.option_num("particle.cpf_weights_method.amisanotristani", "1"); driver.option_num("particle.cpf_weights_method.murrayjonesparslow", "0"); }
| CPF_WEIGHTS EQUAL MURRAYJONESPARSLOW {driver.option_num("particle.cpf_weights_method.amisanotristani", "0"); driver.option_num("particle.cpf_weights_method.murrayjonesparslow", "1"); };
o_filter_algorithm : FILTER_ALGORITHM EQUAL symbol { driver.option_str("particle.filter_algorithm", $3); };
o_nonlinear_filter_initialization : NONLINEAR_FILTER_INITIALIZATION EQUAL INT_NUMBER { driver.option_num("particle.initialization", $3); };
o_proposal_approximation : PROPOSAL_APPROXIMATION EQUAL CUBATURE {driver.option_num("particle.proposal_approximation.cubature", "1"); driver.option_num("particle.proposal_approximation.unscented", "0"); driver.option_num("particle.proposal_approximation.montecarlo", "0");}
| PROPOSAL_APPROXIMATION EQUAL UNSCENTED {driver.option_num("particle.proposal_approximation.cubature", "0"); driver.option_num("particle.proposal_approximation.unscented", "1"); driver.option_num("particle.proposal_approximation.montecarlo", "0");}
| PROPOSAL_APPROXIMATION EQUAL MONTECARLO {driver.option_num("particle.proposal_approximation.cubature", "0"); driver.option_num("particle.proposal_approximation.unscented", "0"); driver.option_num("particle.proposal_approximation.montecarlo", "1");} ;
@ -2987,7 +3112,6 @@ o_gsa_load_redform : LOAD_REDFORM EQUAL INT_NUMBER { driver.option_num("load_red
o_gsa_load_rmse : LOAD_RMSE EQUAL INT_NUMBER { driver.option_num("load_rmse", $3); };
o_gsa_load_stab : LOAD_STAB EQUAL INT_NUMBER { driver.option_num("load_stab", $3); };
o_gsa_alpha2_stab : ALPHA2_STAB EQUAL non_negative_number { driver.option_num("alpha2_stab", $3); };
o_gsa_ksstat : KSSTAT EQUAL non_negative_number { driver.option_num("ksstat", $3); };
o_gsa_logtrans_redform : LOGTRANS_REDFORM EQUAL INT_NUMBER { driver.option_num("logtrans_redform", $3); };
o_gsa_threshold_redform : THRESHOLD_REDFORM EQUAL vec_value_w_inf { driver.option_num("threshold_redform",$3); };
o_gsa_ksstat_redform : KSSTAT_REDFORM EQUAL non_negative_number { driver.option_num("ksstat_redform", $3); };
@ -3234,6 +3358,7 @@ o_mcmc_jumping_covariance : MCMC_JUMPING_COVARIANCE EQUAL HESSIAN
| MCMC_JUMPING_COVARIANCE EQUAL filename
{ driver.option_str("MCMC_jumping_covariance", $3); }
;
o_rescale_prediction_error_covariance : RESCALE_PREDICTION_ERROR_COVARIANCE { driver.option_num("rescale_prediction_error_covariance", "true"); };
o_use_penalized_objective_for_hessian : USE_PENALIZED_OBJECTIVE_FOR_HESSIAN { driver.option_num("hessian.use_penalized_objective","true"); };
o_irf_plot_threshold : IRF_PLOT_THRESHOLD EQUAL non_negative_number { driver.option_num("impulse_responses.plot_threshold", $3); };
o_dr_display_tol : DR_DISPLAY_TOL EQUAL non_negative_number { driver.option_num("dr_display_tol", $3); };
@ -3253,7 +3378,11 @@ o_sampling_draws : SAMPLING_DRAWS EQUAL INT_NUMBER { driver.option_num("sampling
o_use_shock_groups : USE_SHOCK_GROUPS { driver.option_str("use_shock_groups","default"); }
| USE_SHOCK_GROUPS EQUAL symbol { driver.option_str("use_shock_groups", $3); }
;
o_colormap : COLORMAP EQUAL symbol { driver.option_num("colormap",$3); };
o_psd_use_shock_groups : USE_SHOCK_GROUPS { driver.option_str("plot_shock_decomp.use_shock_groups","default"); }
| USE_SHOCK_GROUPS EQUAL symbol { driver.option_str("plot_shock_decomp.use_shock_groups", $3); }
;
o_colormap : COLORMAP EQUAL symbol { driver.option_num("plot_shock_decomp.colormap",$3); };
o_psd_colormap : COLORMAP EQUAL symbol { driver.option_num("plot_shock_decomp.colormap",$3); };
range : symbol ':' symbol
{

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2016 Dynare Team
* Copyright (C) 2003-2017 Dynare Team
*
* This file is part of Dynare.
*
@ -150,6 +150,9 @@ 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>plot_shock_decomposition {BEGIN DYNARE_STATEMENT; return token::PLOT_SHOCK_DECOMPOSITION;}
<INITIAL>initial_condition_decomposition {BEGIN DYNARE_STATEMENT; return token::INITIAL_CONDITION_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;}
@ -373,6 +376,8 @@ 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>indxscalesstates {return token::INDXSCALESSTATES;}
<DYNARE_STATEMENT>fixed_point {return token::FIXED_POINT;}
<DYNARE_STATEMENT>doubling {return token::DOUBLING;}
<DYNARE_STATEMENT>plot_init_date {return token::PLOT_INIT_DATE;}
<DYNARE_STATEMENT>plot_end_date {return token::PLOT_END_DATE;}
<DYNARE_STATEMENT>square_root_solver {return token::SQUARE_ROOT_SOLVER;}
<DYNARE_STATEMENT>cycle_reduction {return token::CYCLE_REDUCTION;}
<DYNARE_STATEMENT>logarithmic_reduction {return token::LOGARITHMIC_REDUCTION;}
@ -393,6 +398,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>amisanotristani {return token::AMISANOTRISTANI;}
<DYNARE_STATEMENT>murrayjonesparslow {return token::MURRAYJONESPARSLOW;}
<DYNARE_STATEMENT>filter_algorithm {return token::FILTER_ALGORITHM;}
<DYNARE_STATEMENT>nonlinear_filter_initialization {return token::NONLINEAR_FILTER_INITIALIZATION;}
<DYNARE_STATEMENT>proposal_approximation {return token::PROPOSAL_APPROXIMATION;}
<DYNARE_STATEMENT>cubature {return token::CUBATURE;}
<DYNARE_STATEMENT>unscented {return token::UNSCENTED;}
@ -400,6 +406,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>distribution_approximation {return token::DISTRIBUTION_APPROXIMATION;}
<DYNARE_STATEMENT>proposal_distribution {return token::PROPOSAL_DISTRIBUTION;}
<DYNARE_STATEMENT>no_posterior_kernel_density {return token::NO_POSTERIOR_KERNEL_DENSITY;}
<DYNARE_STATEMENT>rescale_prediction_error_covariance {return token::RESCALE_PREDICTION_ERROR_COVARIANCE;}
<DYNARE_STATEMENT>use_penalized_objective_for_hessian {return token::USE_PENALIZED_OBJECTIVE_FOR_HESSIAN;}
<DYNARE_STATEMENT>alpha {
@ -459,6 +466,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
yylval->string_val = new string(yytext);
return token::ABAND;
}
<DYNARE_STATEMENT>write_equation_tags {return token::WRITE_EQUATION_TAGS;}
<DYNARE_STATEMENT>indxap {return token::INDXAP;}
<DYNARE_STATEMENT>apband {return token::APBAND;}
<DYNARE_STATEMENT>indximf {return token::INDXIMF;}
@ -570,6 +578,20 @@ 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>detail_plot {return token::DETAIL_PLOT;}
<DYNARE_STATEMENT>interactive {return token::INTERACTIVE;}
<DYNARE_STATEMENT>screen_shocks {return token::SCREEN_SHOCKS;}
<DYNARE_STATEMENT>steadystate {return token::STEADYSTATE;}
<DYNARE_STATEMENT>type {return token::TYPE;}
<DYNARE_STATEMENT>qoq {return token::QOQ; }
<DYNARE_STATEMENT>yoy {return token::YOY; }
<DYNARE_STATEMENT>aoa {return token::AOA; }
<DYNARE_STATEMENT>fig_name {return token::FIG_NAME;}
<DYNARE_STATEMENT>write_xls {return token::WRITE_XLS;}
<DYNARE_STATEMENT>realtime {return token::REALTIME;}
<DYNARE_STATEMENT>vintage {return token::VINTAGE;}
<DYNARE_STATEMENT>prior_mode {return token::PRIOR_MODE; }
<DYNARE_STATEMENT>prior_mean {return token::PRIOR_MEAN; }
<DYNARE_STATEMENT>posterior_mode {return token::POSTERIOR_MODE; }
@ -779,7 +801,6 @@ 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>load_rmse {return token::LOAD_RMSE;}
<DYNARE_STATEMENT>load_stab {return token::LOAD_STAB;}
<DYNARE_STATEMENT>alpha2_stab {return token::ALPHA2_STAB;}
<DYNARE_STATEMENT>ksstat {return token::KSSTAT;}
<DYNARE_STATEMENT>logtrans_redform {return token::LOGTRANS_REDFORM;}
<DYNARE_STATEMENT>threshold_redform {return token::THRESHOLD_REDFORM;}
<DYNARE_STATEMENT>ksstat_redform {return token::KSSTAT_REDFORM;}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2011 Dynare Team
* Copyright (C) 2010-2015 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2011 Dynare Team
* Copyright (C) 2010-2015 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2012 Dynare Team
* Copyright (C) 2009-2017 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -144,7 +144,7 @@ ModFile::checkPass(bool nostrict)
if ((mod_file_struct.ramsey_model_present || mod_file_struct.ramsey_policy_present)
&& mod_file_struct.discretionary_policy_present)
{
cerr << "ERROR: You cannot use the discretionary_policy command when you use either rasmey_model or ramsey_policy and vice versa" << endl;
cerr << "ERROR: You cannot use the discretionary_policy command when you use either ramsey_model or ramsey_policy and vice versa" << endl;
exit(EXIT_FAILURE);
}
@ -277,6 +277,19 @@ ModFile::checkPass(bool nostrict)
|| dynamic_model.isBinaryOpUsed(oDifferent)))
warnings << "WARNING: you are using a function (max, min, abs, sign) or an operator (<, >, <=, >=, ==, !=) which is unsuitable for a stochastic context; see the reference manual, section about \"Expressions\", for more details." << endl;
if (linear
&& (dynamic_model.isUnaryOpUsed(oSign)
|| dynamic_model.isUnaryOpUsed(oAbs)
|| dynamic_model.isBinaryOpUsed(oMax)
|| dynamic_model.isBinaryOpUsed(oMin)
|| dynamic_model.isBinaryOpUsed(oGreater)
|| dynamic_model.isBinaryOpUsed(oLess)
|| dynamic_model.isBinaryOpUsed(oGreaterEqual)
|| dynamic_model.isBinaryOpUsed(oLessEqual)
|| dynamic_model.isBinaryOpUsed(oEqualEqual)
|| dynamic_model.isBinaryOpUsed(oDifferent)))
warnings << "WARNING: you have declared your model 'linear' but you are using a function (max, min, abs, sign) or an operator (<, >, <=, >=, ==, !=) which potentially makes it non-linear." << endl;
// Test if some estimated parameters are used within the values of shocks
// statements (see issue #469)
set<int> parameters_intersect;

View File

@ -232,7 +232,7 @@ ModelTree::computeNonSingularNormalization(jacob_map_t &contemporaneous_jacobian
void
ModelTree::computeNormalizedEquations(multimap<int, int> &endo2eqs) const
{
for (int i = 0; i < equations.size(); i++)
for (size_t i = 0; i < equations.size(); i++)
{
VariableNode *lhs = dynamic_cast<VariableNode *>(equations[i]->get_arg1());
if (lhs == NULL)
@ -247,7 +247,7 @@ ModelTree::computeNormalizedEquations(multimap<int, int> &endo2eqs) const
if (endo.find(make_pair(symbol_table.getTypeSpecificID(symb_id), 0)) != endo.end())
continue;
endo2eqs.insert(make_pair(symbol_table.getTypeSpecificID(symb_id), i));
endo2eqs.insert(make_pair(symbol_table.getTypeSpecificID(symb_id), (int) i));
cout << "Endogenous " << symbol_table.getName(symb_id) << " normalized in equation " << (i+1) << endl;
}
}
@ -1631,7 +1631,7 @@ ModelTree::Write_Inf_To_Bin_File(const string &basename,
}
void
ModelTree::writeLatexModelFile(const string &basename, ExprNodeOutputType output_type) const
ModelTree::writeLatexModelFile(const string &basename, ExprNodeOutputType output_type, const bool write_equation_tags) const
{
ofstream output, content_output;
string filename = basename + ".tex";
@ -1675,8 +1675,31 @@ ModelTree::writeLatexModelFile(const string &basename, ExprNodeOutputType output
for (int eq = 0; eq < (int) equations.size(); eq++)
{
content_output << "\\begin{dmath}" << endl
<< "% Equation " << eq+1 << endl;
content_output << "% Equation " << eq + 1 << endl;
bool wrote_eq_tag = false;
if (write_equation_tags)
{
for (vector<pair<int, pair<string, string> > >::const_iterator iteqt = equation_tags.begin();
iteqt != equation_tags.end(); iteqt++)
if (iteqt->first == eq)
{
if (!wrote_eq_tag)
content_output << "\\noindent[";
else
content_output << ", ";
content_output << iteqt->second.first;
if (iteqt->second.second.empty())
content_output << "= `" << iteqt->second.second << "'";
wrote_eq_tag = true;
}
}
if (wrote_eq_tag)
content_output << "]";
content_output << "\\begin{dmath}" << endl;
// Here it is necessary to cast to superclass ExprNode, otherwise the overloaded writeOutput() method is not found
dynamic_cast<ExprNode *>(equations[eq])->writeOutput(content_output, output_type);
content_output << endl << "\\end{dmath}" << endl;
@ -1746,7 +1769,7 @@ ModelTree::addNonstationaryVariables(vector<int> nonstationary_vars, bool log_de
void
ModelTree::initializeVariablesAndEquations()
{
for (int j = 0; j < equations.size(); j++)
for (size_t j = 0; j < equations.size(); j++)
{
equation_reordered.push_back(j);
variable_reordered.push_back(j);

View File

@ -200,7 +200,7 @@ protected:
void compileModelEquations(ostream &code_file, unsigned int &instruction_number, const temporary_terms_t &tt, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic) const;
//! Writes LaTeX model file
void writeLatexModelFile(const string &basename, ExprNodeOutputType output_type) const;
void writeLatexModelFile(const string &basename, ExprNodeOutputType output_type, const bool write_equation_tags = false) const;
//! Sparse matrix of double to store the values of the Jacobian
/*! First index is equation number, second index is endogenous type specific ID */

View File

@ -245,12 +245,12 @@ InitValStatement::writeJsonOutput(ostream &output) const
void
InitValStatement::writeOutputPostInit(ostream &output) const
{
output << "if M_.exo_nbr > 0;" << endl
<< "\too_.exo_simul = [ones(M_.maximum_lag,1)*oo_.exo_steady_state'];" << endl
<<"end;" << endl
<< "if M_.exo_det_nbr > 0;" << endl
<< "\too_.exo_det_simul = [ones(M_.maximum_lag,1)*oo_.exo_det_steady_state'];" << endl
<<"end;" << endl;
output << "if M_.exo_nbr > 0" << endl
<< "\too_.exo_simul = ones(M_.maximum_lag,1)*oo_.exo_steady_state';" << endl
<<"end" << endl
<< "if M_.exo_det_nbr > 0" << endl
<< "\too_.exo_det_simul = ones(M_.maximum_lag,1)*oo_.exo_det_steady_state';" << endl
<<"end" << endl;
}
EndValStatement::EndValStatement(const init_values_t &init_values_arg,
@ -319,8 +319,6 @@ HistValStatement::HistValStatement(const hist_values_t &hist_values_arg,
void
HistValStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
{
mod_file_struct.histval_present = true;
if (all_values_required)
{
set<int> unused_endo = symbol_table.getEndogenous();

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2016 Dynare Team
* Copyright (C) 2003-2017 Dynare Team
*
* This file is part of Dynare.
*
@ -1962,9 +1962,9 @@ ParsingDriver::discretionary_policy()
}
void
ParsingDriver::write_latex_dynamic_model()
ParsingDriver::write_latex_dynamic_model(bool write_equation_tags)
{
mod_file->addStatement(new WriteLatexDynamicModelStatement(mod_file->dynamic_model));
mod_file->addStatement(new WriteLatexDynamicModelStatement(mod_file->dynamic_model, write_equation_tags));
}
void
@ -2124,6 +2124,30 @@ 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::plot_shock_decomposition()
{
mod_file->addStatement(new PlotShockDecompositionStatement(symbol_list, options_list));
symbol_list.clear();
options_list.clear();
}
void
ParsingDriver::initial_condition_decomposition()
{
mod_file->addStatement(new InitialConditionDecompositionStatement(symbol_list, options_list));
symbol_list.clear();
options_list.clear();
}
void
ParsingDriver::conditional_forecast()
{
@ -2216,7 +2240,7 @@ ParsingDriver::declare_and_init_model_local_variable(string *name, expr_t rhs)
// It can have already been declared in a steady_state_model block, check that it is indeed a ModelLocalVariable
symb_id = mod_file->symbol_table.getID(*name);
if (mod_file->symbol_table.getType(symb_id) != eModelLocalVariable)
error(*name + " has wrong type, you cannot use it within as left-hand side of a pound ('#') expression");
error(*name + " has wrong type or was already used on the right-hand side. You cannot use it on the left-hand side of a pound ('#') expression");
}
try
@ -2806,6 +2830,13 @@ ParsingDriver::process_graph_format_option()
graph_formats.clear();
}
void
ParsingDriver::plot_shock_decomp_process_graph_format_option()
{
options_list.symbol_list_options["plot_shock_decomp.graph_format"] = graph_formats;
graph_formats.clear();
}
void
ParsingDriver::model_diagnostics()
{

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2016 Dynare Team
* Copyright (C) 2003-2017 Dynare Team
*
* This file is part of Dynare.
*
@ -561,7 +561,7 @@ public:
//! Discretionary policy statement
void discretionary_policy();
//! Adds a write_latex_dynamic_model statement
void write_latex_dynamic_model();
void write_latex_dynamic_model(bool write_equation_tags);
//! Adds a write_latex_static_model statement
void write_latex_static_model();
//! Adds a write_latex_original_model statement
@ -592,6 +592,12 @@ public:
void markov_switching();
//! Shock decomposition
void shock_decomposition();
//! Realtime Shock decomposition
void realtime_shock_decomposition();
//! Plot Shock decomposition
void plot_shock_decomposition();
//! Initial Condition decomposition
void initial_condition_decomposition();
//! Conditional forecast statement
void conditional_forecast();
//! Conditional forecast paths block
@ -722,6 +728,8 @@ public:
void add_graph_format(const string &name);
//! Add the graph_format option to the OptionsList structure
void process_graph_format_option();
//! Add the graph_format option to the plot_shock_decomp substructure of the OptionsList structure
void plot_shock_decomp_process_graph_format_option();
//! Model diagnostics
void model_diagnostics();
//! Processing the parallel_local_files option

View File

@ -40,7 +40,6 @@ ModFileStructure::ModFileStructure() :
identification_present(false),
estimation_analytic_derivation(false),
partial_information(false),
histval_present(false),
k_order_solver(false),
calibrated_measurement_errors(false),
dsge_prior_weight_in_estimated_params(false),

View File

@ -72,9 +72,6 @@ public:
bool estimation_analytic_derivation;
//! Whether the option partial_information is given to stoch_simul/estimation/osr/ramsey_policy
bool partial_information;
//! Whether a histval bloc is present
/*! Used for the workaround for trac ticket #157 */
bool histval_present;
//! Whether the "k_order_solver" option is used (explictly, or implicitly if order >= 3)
bool k_order_solver;
//! Whether there is a calibrated measurement error

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2016 Dynare Team
* Copyright (C) 2010-2017 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2013 Dynare Team
* Copyright (C) 2012-2017 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2013 Dynare Team
* Copyright (C) 2012-2017 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2015 Dynare Team
* Copyright (C) 2008-2017 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2015 Dynare Team
* Copyright (C) 2008-2017 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2013 Dynare Team
* Copyright (C) 2008-2014 Dynare Team
*
* This file is part of Dynare.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2008-2016 Dynare Team
* Copyright (C) 2008-2017 Dynare Team
*
* This file is part of Dynare.
*