Merge branch 'master' into remove-dynDate-class
commit
aa4753f9ec
|
@ -2411,6 +2411,12 @@ CalibSmootherStatement::CalibSmootherStatement(const SymbolList &symbol_list_arg
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CalibSmootherStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
|
||||||
|
{
|
||||||
|
mod_file_struct.calib_smoother_present = true;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CalibSmootherStatement::writeOutput(ostream &output, const string &basename) const
|
CalibSmootherStatement::writeOutput(ostream &output, const string &basename) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -516,6 +516,7 @@ private:
|
||||||
public:
|
public:
|
||||||
CalibSmootherStatement(const SymbolList &symbol_list_arg,
|
CalibSmootherStatement(const SymbolList &symbol_list_arg,
|
||||||
const OptionsList &options_list_arg);
|
const OptionsList &options_list_arg);
|
||||||
|
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
|
||||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2913,25 +2913,22 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
|
||||||
output << "M_.exo_names_orig_ord = [1:" << symbol_table.exo_nbr() << "];" << endl
|
output << "M_.exo_names_orig_ord = [1:" << symbol_table.exo_nbr() << "];" << endl
|
||||||
<< "M_.maximum_lag = " << max_lag << ";" << endl
|
<< "M_.maximum_lag = " << max_lag << ";" << endl
|
||||||
<< "M_.maximum_lead = " << max_lead << ";" << endl;
|
<< "M_.maximum_lead = " << max_lead << ";" << endl;
|
||||||
if (symbol_table.endo_nbr())
|
|
||||||
{
|
|
||||||
output << "M_.maximum_endo_lag = " << max_endo_lag << ";" << endl
|
output << "M_.maximum_endo_lag = " << max_endo_lag << ";" << endl
|
||||||
<< "M_.maximum_endo_lead = " << max_endo_lead << ";" << endl
|
<< "M_.maximum_endo_lead = " << max_endo_lead << ";" << endl
|
||||||
<< "oo_.steady_state = zeros(" << symbol_table.endo_nbr() << ", 1);" << endl;
|
<< "oo_.steady_state = zeros(" << symbol_table.endo_nbr() << ", 1);" << endl;
|
||||||
}
|
|
||||||
if (symbol_table.exo_nbr())
|
|
||||||
{
|
|
||||||
output << "M_.maximum_exo_lag = " << max_exo_lag << ";" << endl
|
output << "M_.maximum_exo_lag = " << max_exo_lag << ";" << endl
|
||||||
<< "M_.maximum_exo_lead = " << max_exo_lead << ";" << endl
|
<< "M_.maximum_exo_lead = " << max_exo_lead << ";" << endl
|
||||||
<< "oo_.exo_steady_state = zeros(" << symbol_table.exo_nbr() << ", 1);" << endl;
|
<< "oo_.exo_steady_state = zeros(" << symbol_table.exo_nbr() << ", 1);" << endl;
|
||||||
}
|
|
||||||
if (symbol_table.exo_det_nbr())
|
if (symbol_table.exo_det_nbr())
|
||||||
{
|
{
|
||||||
output << "M_.maximum_exo_det_lag = " << max_exo_det_lag << ";" << endl
|
output << "M_.maximum_exo_det_lag = " << max_exo_det_lag << ";" << endl
|
||||||
<< "M_.maximum_exo_det_lead = " << max_exo_det_lead << ";" << endl
|
<< "M_.maximum_exo_det_lead = " << max_exo_det_lead << ";" << endl
|
||||||
<< "oo_.exo_det_steady_state = zeros(" << symbol_table.exo_det_nbr() << ", 1);" << endl;
|
<< "oo_.exo_det_steady_state = zeros(" << symbol_table.exo_det_nbr() << ", 1);" << endl;
|
||||||
}
|
}
|
||||||
if (symbol_table.param_nbr())
|
|
||||||
output << "M_.params = NaN(" << symbol_table.param_nbr() << ", 1);" << endl;
|
output << "M_.params = NaN(" << symbol_table.param_nbr() << ", 1);" << endl;
|
||||||
|
|
||||||
// Write number of non-zero derivatives
|
// Write number of non-zero derivatives
|
||||||
|
@ -3757,8 +3754,13 @@ DynamicModel::testTrendDerivativesEqualToZero(const eval_context_t &eval_context
|
||||||
|| symbol_table.getType(it->first.first) == eLogTrend)
|
|| symbol_table.getType(it->first.first) == eLogTrend)
|
||||||
for (int eq = 0; eq < (int) equations.size(); eq++)
|
for (int eq = 0; eq < (int) equations.size(); eq++)
|
||||||
{
|
{
|
||||||
expr_t testeq = AddLog(AddMinus(equations[eq]->get_arg1(), // F: a = b -> ln(a - b)
|
expr_t homogeneq = AddMinus(equations[eq]->get_arg1(),
|
||||||
equations[eq]->get_arg2()));
|
equations[eq]->get_arg2());
|
||||||
|
|
||||||
|
// Do not run the test if the term inside the log is zero
|
||||||
|
if (fabs(homogeneq->eval(eval_context)) > ZERO_BAND)
|
||||||
|
{
|
||||||
|
expr_t testeq = AddLog(homogeneq); // F = log(lhs-rhs)
|
||||||
testeq = testeq->getDerivative(it->second); // d F / d Trend
|
testeq = testeq->getDerivative(it->second); // d F / d Trend
|
||||||
for (deriv_id_table_t::const_iterator endogit = deriv_id_table.begin();
|
for (deriv_id_table_t::const_iterator endogit = deriv_id_table.begin();
|
||||||
endogit != deriv_id_table.end(); endogit++)
|
endogit != deriv_id_table.end(); endogit++)
|
||||||
|
@ -3774,6 +3776,7 @@ DynamicModel::testTrendDerivativesEqualToZero(const eval_context_t &eval_context
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -4134,8 +4137,9 @@ DynamicModel::transformPredeterminedVariables()
|
||||||
void
|
void
|
||||||
DynamicModel::detrendEquations()
|
DynamicModel::detrendEquations()
|
||||||
{
|
{
|
||||||
for (nonstationary_symbols_map_t::const_iterator it = nonstationary_symbols_map.begin();
|
// We go backwards in the list of trend_vars, to deal correctly with I(2) processes
|
||||||
it != nonstationary_symbols_map.end(); it++)
|
for (nonstationary_symbols_map_t::const_reverse_iterator it = nonstationary_symbols_map.rbegin();
|
||||||
|
it != nonstationary_symbols_map.rend(); ++it)
|
||||||
for (int i = 0; i < (int) equations.size(); i++)
|
for (int i = 0; i < (int) equations.size(); i++)
|
||||||
{
|
{
|
||||||
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equations[i]->detrend(it->first, it->second.first, it->second.second));
|
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equations[i]->detrend(it->first, it->second.first, it->second.second));
|
||||||
|
|
|
@ -101,7 +101,7 @@ class ParsingDriver;
|
||||||
%token FILENAME FILTER_STEP_AHEAD FILTERED_VARS FIRST_OBS LAST_OBS SET_TIME
|
%token FILENAME FILTER_STEP_AHEAD FILTERED_VARS FIRST_OBS LAST_OBS SET_TIME
|
||||||
%token <string_val> FLOAT_NUMBER
|
%token <string_val> FLOAT_NUMBER
|
||||||
%token DEFAULT FIXED_POINT
|
%token DEFAULT FIXED_POINT
|
||||||
%token FORECAST K_ORDER_SOLVER INSTRUMENTS PRIOR SHIFT MEAN STDEV VARIANCE MODE INTERVAL SHAPE DOMAINN
|
%token FORECAST K_ORDER_SOLVER INSTRUMENTS SHIFT MEAN STDEV VARIANCE MODE INTERVAL SHAPE DOMAINN
|
||||||
%token GAMMA_PDF GRAPH GRAPH_FORMAT CONDITIONAL_VARIANCE_DECOMPOSITION NOCHECK STD
|
%token GAMMA_PDF GRAPH GRAPH_FORMAT CONDITIONAL_VARIANCE_DECOMPOSITION NOCHECK STD
|
||||||
%token HISTVAL HOMOTOPY_SETUP HOMOTOPY_MODE HOMOTOPY_STEPS HOMOTOPY_FORCE_CONTINUE HP_FILTER HP_NGRID HYBRID
|
%token HISTVAL HOMOTOPY_SETUP HOMOTOPY_MODE HOMOTOPY_STEPS HOMOTOPY_FORCE_CONTINUE HP_FILTER HP_NGRID HYBRID
|
||||||
%token IDENTIFICATION INF_CONSTANT INITVAL INITVAL_FILE BOUNDS JSCALE INIT
|
%token IDENTIFICATION INF_CONSTANT INITVAL INITVAL_FILE BOUNDS JSCALE INIT
|
||||||
|
@ -113,7 +113,7 @@ class ParsingDriver;
|
||||||
%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 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_DROP MH_INIT_SCALE MH_JSCALE MH_MODE MH_NBLOCKS MH_REPLIC MH_RECOVER MIN MINIMAL_SOLVING_PERIODS
|
%token MFS MH_DROP MH_INIT_SCALE MH_JSCALE MH_MODE MH_NBLOCKS MH_REPLIC MH_RECOVER 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 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 DIFFUSE_FILTER SUB_DRAWS TAPER_STEPS GEWEKE_INTERVAL
|
%token MODEL_DIAGNOSTICS MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER SUB_DRAWS TAPER_STEPS GEWEKE_INTERVAL MCMC_JUMPING_COVARIANCE
|
||||||
%token <string_val> NAME
|
%token <string_val> NAME
|
||||||
%token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NODISPLAY NOCORR NODIAGNOSTIC NOFUNCTIONS
|
%token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NODISPLAY NOCORR NODIAGNOSTIC NOFUNCTIONS
|
||||||
%token NOGRAPH NOMOMENTS NOPRINT NORMAL_PDF SAVE_DRAWS
|
%token NOGRAPH NOMOMENTS NOPRINT NORMAL_PDF SAVE_DRAWS
|
||||||
|
@ -151,7 +151,7 @@ class ParsingDriver;
|
||||||
%token VLISTLOG VLISTPER
|
%token VLISTLOG VLISTPER
|
||||||
%token RESTRICTION RESTRICTION_FNAME CROSS_RESTRICTIONS NLAGS CONTEMP_REDUCED_FORM REAL_PSEUDO_FORECAST
|
%token RESTRICTION RESTRICTION_FNAME CROSS_RESTRICTIONS NLAGS CONTEMP_REDUCED_FORM REAL_PSEUDO_FORECAST
|
||||||
%token DUMMY_OBS NSTATES INDXSCALESSTATES NO_BAYESIAN_PRIOR SPECIFICATION SIMS_ZHA
|
%token DUMMY_OBS NSTATES INDXSCALESSTATES NO_BAYESIAN_PRIOR SPECIFICATION SIMS_ZHA
|
||||||
%token <string_val> ALPHA BETA ABAND NINV CMS NCMS CNUM GAMMA INV_GAMMA INV_GAMMA1 INV_GAMMA2 NORMAL UNIFORM EPS PDF FIG DR NONE
|
%token <string_val> ALPHA BETA ABAND NINV CMS NCMS CNUM GAMMA INV_GAMMA INV_GAMMA1 INV_GAMMA2 NORMAL UNIFORM EPS PDF FIG DR NONE PRIOR PRIOR_VARIANCE HESSIAN IDENTITY_MATRIX
|
||||||
%token GSIG2_LMDM Q_DIAG FLAT_PRIOR NCSK NSTD
|
%token GSIG2_LMDM Q_DIAG FLAT_PRIOR NCSK NSTD
|
||||||
%token INDXPARR INDXOVR INDXAP APBAND INDXIMF IMFBAND INDXFORE FOREBAND INDXGFOREHAT INDXGIMFHAT
|
%token INDXPARR INDXOVR INDXAP APBAND INDXIMF IMFBAND INDXFORE FOREBAND INDXGFOREHAT INDXGIMFHAT
|
||||||
%token INDXESTIMA INDXGDLS EQ_MS FILTER_COVARIANCE FILTER_DECOMPOSITION
|
%token INDXESTIMA INDXGDLS EQ_MS FILTER_COVARIANCE FILTER_DECOMPOSITION
|
||||||
|
@ -1554,6 +1554,7 @@ estimation_options : o_datafile
|
||||||
| o_qz_zero_threshold
|
| o_qz_zero_threshold
|
||||||
| o_taper_steps
|
| o_taper_steps
|
||||||
| o_geweke_interval
|
| o_geweke_interval
|
||||||
|
| o_mcmc_jumping_covariance
|
||||||
;
|
;
|
||||||
|
|
||||||
list_optim_option : QUOTED_STRING COMMA QUOTED_STRING
|
list_optim_option : QUOTED_STRING COMMA QUOTED_STRING
|
||||||
|
@ -2673,6 +2674,14 @@ o_discretionary_tol: DISCRETIONARY_TOL EQUAL non_negative_number { driver.option
|
||||||
o_analytic_derivation : ANALYTIC_DERIVATION { driver.option_num("analytic_derivation", "1"); }
|
o_analytic_derivation : ANALYTIC_DERIVATION { driver.option_num("analytic_derivation", "1"); }
|
||||||
o_endogenous_prior : ENDOGENOUS_PRIOR { driver.option_num("endogenous_prior", "1"); }
|
o_endogenous_prior : ENDOGENOUS_PRIOR { driver.option_num("endogenous_prior", "1"); }
|
||||||
o_use_univariate_filters_if_singularity_is_detected : USE_UNIVARIATE_FILTERS_IF_SINGULARITY_IS_DETECTED EQUAL INT_NUMBER { driver.option_num("use_univariate_filters_if_singularity_is_detected", $3); }
|
o_use_univariate_filters_if_singularity_is_detected : USE_UNIVARIATE_FILTERS_IF_SINGULARITY_IS_DETECTED EQUAL INT_NUMBER { driver.option_num("use_univariate_filters_if_singularity_is_detected", $3); }
|
||||||
|
o_mcmc_jumping_covariance : MCMC_JUMPING_COVARIANCE EQUAL HESSIAN
|
||||||
|
{ driver.option_str("MCMC_jumping_covariance", $3); } | MCMC_JUMPING_COVARIANCE EQUAL PRIOR_VARIANCE
|
||||||
|
{ driver.option_str("MCMC_jumping_covariance", $3); }
|
||||||
|
| MCMC_JUMPING_COVARIANCE EQUAL IDENTITY_MATRIX
|
||||||
|
{ driver.option_str("MCMC_jumping_covariance", $3); }
|
||||||
|
| MCMC_JUMPING_COVARIANCE EQUAL filename
|
||||||
|
{ driver.option_str("MCMC_jumping_covariance", $3); }
|
||||||
|
;
|
||||||
|
|
||||||
range : symbol ':' symbol
|
range : symbol ':' symbol
|
||||||
{
|
{
|
||||||
|
@ -2791,6 +2800,7 @@ symbol : NAME
|
||||||
| FIG
|
| FIG
|
||||||
| NONE
|
| NONE
|
||||||
| DR
|
| DR
|
||||||
|
| PRIOR
|
||||||
;
|
;
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,10 @@ string eofbuff;
|
||||||
|
|
||||||
<DYNARE_STATEMENT>subsamples {return token::SUBSAMPLES;}
|
<DYNARE_STATEMENT>subsamples {return token::SUBSAMPLES;}
|
||||||
<DYNARE_STATEMENT>options {return token::OPTIONS;}
|
<DYNARE_STATEMENT>options {return token::OPTIONS;}
|
||||||
<DYNARE_STATEMENT>prior {return token::PRIOR;}
|
<DYNARE_STATEMENT>prior {
|
||||||
|
yylval->string_val = new string(yytext);
|
||||||
|
return token::PRIOR;
|
||||||
|
}
|
||||||
<INITIAL>std {BEGIN DYNARE_STATEMENT; return token::STD;}
|
<INITIAL>std {BEGIN DYNARE_STATEMENT; return token::STD;}
|
||||||
<INITIAL>corr {BEGIN DYNARE_STATEMENT; return token::CORR;}
|
<INITIAL>corr {BEGIN DYNARE_STATEMENT; return token::CORR;}
|
||||||
|
|
||||||
|
@ -436,6 +439,19 @@ string eofbuff;
|
||||||
<DYNARE_STATEMENT>random_parameter_convergence_criterion {return token::RANDOM_PARAMETER_CONVERGENCE_CRITERION;}
|
<DYNARE_STATEMENT>random_parameter_convergence_criterion {return token::RANDOM_PARAMETER_CONVERGENCE_CRITERION;}
|
||||||
<DYNARE_STATEMENT>tolf {return token::TOLF;}
|
<DYNARE_STATEMENT>tolf {return token::TOLF;}
|
||||||
<DYNARE_STATEMENT>instruments {return token::INSTRUMENTS;}
|
<DYNARE_STATEMENT>instruments {return token::INSTRUMENTS;}
|
||||||
|
<DYNARE_STATEMENT>hessian {
|
||||||
|
yylval->string_val = new string(yytext);
|
||||||
|
return token::HESSIAN;
|
||||||
|
}
|
||||||
|
<DYNARE_STATEMENT>prior_variance {
|
||||||
|
yylval->string_val = new string(yytext);
|
||||||
|
return token::PRIOR_VARIANCE;
|
||||||
|
}
|
||||||
|
<DYNARE_STATEMENT>identity_matrix {
|
||||||
|
yylval->string_val = new string(yytext);
|
||||||
|
return token::IDENTITY_MATRIX;
|
||||||
|
}
|
||||||
|
<DYNARE_STATEMENT>mcmc_jumping_covariance {return token::MCMC_JUMPING_COVARIANCE;}
|
||||||
|
|
||||||
/* These four (var, varexo, varexo_det, parameters) are for change_type */
|
/* These four (var, varexo, varexo_det, parameters) are for change_type */
|
||||||
<DYNARE_STATEMENT>var { return token::VAR; }
|
<DYNARE_STATEMENT>var { return token::VAR; }
|
||||||
|
|
10
ExprNode.cc
10
ExprNode.cc
|
@ -21,15 +21,11 @@
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
// For select1st()
|
|
||||||
#ifdef __GNUC__
|
|
||||||
# include <ext/functional>
|
|
||||||
using namespace __gnu_cxx;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
#include "ExprNode.hh"
|
#include "ExprNode.hh"
|
||||||
#include "DataTree.hh"
|
#include "DataTree.hh"
|
||||||
#include "ModFile.hh"
|
#include "ModFile.hh"
|
||||||
|
@ -110,7 +106,7 @@ ExprNode::collectModelLocalVariables(set<int> &result) const
|
||||||
set<pair<int, int> > symb_ids;
|
set<pair<int, int> > symb_ids;
|
||||||
collectVariables(eModelLocalVariable, symb_ids);
|
collectVariables(eModelLocalVariable, symb_ids);
|
||||||
transform(symb_ids.begin(), symb_ids.end(), inserter(result, result.begin()),
|
transform(symb_ids.begin(), symb_ids.end(), inserter(result, result.begin()),
|
||||||
select1st<pair<int, int> >());
|
boost::bind(&pair<int,int>::first,_1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
24
ModFile.cc
24
ModFile.cc
|
@ -123,7 +123,8 @@ ModFile::checkPass()
|
||||||
|| mod_file_struct.estimation_present
|
|| mod_file_struct.estimation_present
|
||||||
|| mod_file_struct.osr_present
|
|| mod_file_struct.osr_present
|
||||||
|| mod_file_struct.ramsey_policy_present
|
|| mod_file_struct.ramsey_policy_present
|
||||||
|| mod_file_struct.discretionary_policy_present;
|
|| mod_file_struct.discretionary_policy_present
|
||||||
|
|| mod_file_struct.calib_smoother_present;
|
||||||
|
|
||||||
// Allow empty model only when doing a standalone BVAR estimation
|
// Allow empty model only when doing a standalone BVAR estimation
|
||||||
if (dynamic_model.equation_number() == 0
|
if (dynamic_model.equation_number() == 0
|
||||||
|
@ -318,7 +319,8 @@ ModFile::transformPass(bool nostrict)
|
||||||
|| mod_file_struct.estimation_present
|
|| mod_file_struct.estimation_present
|
||||||
|| mod_file_struct.osr_present
|
|| mod_file_struct.osr_present
|
||||||
|| mod_file_struct.ramsey_policy_present
|
|| mod_file_struct.ramsey_policy_present
|
||||||
|| mod_file_struct.discretionary_policy_present)
|
|| mod_file_struct.discretionary_policy_present
|
||||||
|
|| mod_file_struct.calib_smoother_present)
|
||||||
{
|
{
|
||||||
// In stochastic models, create auxiliary vars for leads and lags greater than 2, on both endos and exos
|
// In stochastic models, create auxiliary vars for leads and lags greater than 2, on both endos and exos
|
||||||
dynamic_model.substituteEndoLeadGreaterThanTwo(false);
|
dynamic_model.substituteEndoLeadGreaterThanTwo(false);
|
||||||
|
@ -423,7 +425,8 @@ ModFile::computingPass(bool no_tmp_terms)
|
||||||
{
|
{
|
||||||
if (mod_file_struct.stoch_simul_present
|
if (mod_file_struct.stoch_simul_present
|
||||||
|| mod_file_struct.estimation_present || mod_file_struct.osr_present
|
|| mod_file_struct.estimation_present || mod_file_struct.osr_present
|
||||||
|| mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present)
|
|| mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present
|
||||||
|
|| mod_file_struct.calib_smoother_present)
|
||||||
static_model.set_cutoff_to_zero();
|
static_model.set_cutoff_to_zero();
|
||||||
|
|
||||||
const bool static_hessian = mod_file_struct.identification_present
|
const bool static_hessian = mod_file_struct.identification_present
|
||||||
|
@ -437,7 +440,8 @@ ModFile::computingPass(bool no_tmp_terms)
|
||||||
if (mod_file_struct.simul_present || mod_file_struct.check_present
|
if (mod_file_struct.simul_present || mod_file_struct.check_present
|
||||||
|| mod_file_struct.stoch_simul_present
|
|| mod_file_struct.stoch_simul_present
|
||||||
|| mod_file_struct.estimation_present || mod_file_struct.osr_present
|
|| mod_file_struct.estimation_present || mod_file_struct.osr_present
|
||||||
|| mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present)
|
|| mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present
|
||||||
|
|| mod_file_struct.calib_smoother_present)
|
||||||
{
|
{
|
||||||
if (mod_file_struct.simul_present)
|
if (mod_file_struct.simul_present)
|
||||||
dynamic_model.computingPass(true, false, false, false, global_eval_context, no_tmp_terms, block, use_dll, byte_code);
|
dynamic_model.computingPass(true, false, false, false, global_eval_context, no_tmp_terms, block, use_dll, byte_code);
|
||||||
|
@ -445,7 +449,8 @@ ModFile::computingPass(bool no_tmp_terms)
|
||||||
{
|
{
|
||||||
if (mod_file_struct.stoch_simul_present
|
if (mod_file_struct.stoch_simul_present
|
||||||
|| mod_file_struct.estimation_present || mod_file_struct.osr_present
|
|| mod_file_struct.estimation_present || mod_file_struct.osr_present
|
||||||
|| mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present)
|
|| mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present
|
||||||
|
|| mod_file_struct.calib_smoother_present)
|
||||||
dynamic_model.set_cutoff_to_zero();
|
dynamic_model.set_cutoff_to_zero();
|
||||||
if (mod_file_struct.order_option < 1 || mod_file_struct.order_option > 3)
|
if (mod_file_struct.order_option < 1 || mod_file_struct.order_option > 3)
|
||||||
{
|
{
|
||||||
|
@ -532,15 +537,20 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
|
||||||
|
|
||||||
symbol_table.writeOutput(mOutputFile);
|
symbol_table.writeOutput(mOutputFile);
|
||||||
|
|
||||||
// Initialize M_.Sigma_e and M_.H
|
// Initialize M_.Sigma_e, M_.Correlation_matrix, M_.H, and M_.Correlation_matrix_ME
|
||||||
mOutputFile << "M_.Sigma_e = zeros(" << symbol_table.exo_nbr() << ", "
|
mOutputFile << "M_.Sigma_e = zeros(" << symbol_table.exo_nbr() << ", "
|
||||||
|
<< symbol_table.exo_nbr() << ");" << endl
|
||||||
|
<< "M_.Correlation_matrix = eye(" << symbol_table.exo_nbr() << ", "
|
||||||
<< symbol_table.exo_nbr() << ");" << endl;
|
<< symbol_table.exo_nbr() << ");" << endl;
|
||||||
|
|
||||||
if (mod_file_struct.calibrated_measurement_errors)
|
if (mod_file_struct.calibrated_measurement_errors)
|
||||||
mOutputFile << "M_.H = zeros(" << symbol_table.observedVariablesNbr() << ", "
|
mOutputFile << "M_.H = zeros(" << symbol_table.observedVariablesNbr() << ", "
|
||||||
|
<< symbol_table.observedVariablesNbr() << ");" << endl
|
||||||
|
<< "M_.Correlation_matrix_ME = eye(" << symbol_table.observedVariablesNbr() << ", "
|
||||||
<< symbol_table.observedVariablesNbr() << ");" << endl;
|
<< symbol_table.observedVariablesNbr() << ");" << endl;
|
||||||
else
|
else
|
||||||
mOutputFile << "M_.H = 0;" << endl;
|
mOutputFile << "M_.H = 0;" << endl
|
||||||
|
<< "M_.Correlation_matrix_ME = 1;" << endl;
|
||||||
|
|
||||||
if (linear == 1)
|
if (linear == 1)
|
||||||
mOutputFile << "options_.linear = 1;" << endl;
|
mOutputFile << "options_.linear = 1;" << endl;
|
||||||
|
|
|
@ -1567,3 +1567,10 @@ ModelTree::computeParamsDerivativesTemporaryTerms()
|
||||||
it != hessian_params_derivatives.end(); ++it)
|
it != hessian_params_derivatives.end(); ++it)
|
||||||
it->second->computeTemporaryTerms(reference_count, params_derivs_temporary_terms, true);
|
it->second->computeTemporaryTerms(reference_count, params_derivs_temporary_terms, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ModelTree::isNonstationary(int symb_id) const
|
||||||
|
{
|
||||||
|
return (nonstationary_symbols_map.find(symb_id)
|
||||||
|
!= nonstationary_symbols_map.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -307,6 +307,8 @@ public:
|
||||||
void addTrendVariables(vector<int> trend_vars, expr_t growth_factor) throw (TrendException);
|
void addTrendVariables(vector<int> trend_vars, expr_t growth_factor) throw (TrendException);
|
||||||
//! Adds a nonstationary variables with their (common) deflator
|
//! Adds a nonstationary variables with their (common) deflator
|
||||||
void addNonstationaryVariables(vector<int> nonstationary_vars, bool log_deflator, expr_t deflator) throw (TrendException);
|
void addNonstationaryVariables(vector<int> nonstationary_vars, bool log_deflator, expr_t deflator) throw (TrendException);
|
||||||
|
//! Is a given variable non-stationary?
|
||||||
|
bool isNonstationary(int symb_id) const;
|
||||||
void set_cutoff_to_zero();
|
void set_cutoff_to_zero();
|
||||||
//! Helper for writing the Jacobian elements in MATLAB and C
|
//! Helper for writing the Jacobian elements in MATLAB and C
|
||||||
/*! Writes either (i+1,j+1) or [i+j*no_eq] */
|
/*! Writes either (i+1,j+1) or [i+j*no_eq] */
|
||||||
|
|
|
@ -357,6 +357,13 @@ ParsingDriver::end_nonstationary_var(bool log_deflator, expr_t deflator)
|
||||||
{
|
{
|
||||||
error("Variable " + e.name + " was listed more than once as following a trend.");
|
error("Variable " + e.name + " was listed more than once as following a trend.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set<pair<int, int> > r;
|
||||||
|
deflator->collectVariables(eEndogenous, r);
|
||||||
|
for (set<pair<int, int> >::const_iterator it = r.begin(); it != r.end(); ++it)
|
||||||
|
if (dynamic_model->isNonstationary(it->first))
|
||||||
|
error("The deflator contains a non-stationary endogenous variable. This is not allowed. Please use only stationary endogenous and/or {log_}trend_vars.");
|
||||||
|
|
||||||
declared_nonstationary_vars.clear();
|
declared_nonstationary_vars.clear();
|
||||||
reset_data_tree();
|
reset_data_tree();
|
||||||
}
|
}
|
||||||
|
|
13
Shocks.cc
13
Shocks.cc
|
@ -155,17 +155,19 @@ ShocksStatement::writeCovarOrCorrShock(ostream &output, covar_and_corr_shocks_t:
|
||||||
SymbolType type2 = symbol_table.getType(it->first.second);
|
SymbolType type2 = symbol_table.getType(it->first.second);
|
||||||
assert((type1 == eExogenous && type2 == eExogenous)
|
assert((type1 == eExogenous && type2 == eExogenous)
|
||||||
|| (symbol_table.isObservedVariable(it->first.first) && symbol_table.isObservedVariable(it->first.second)));
|
|| (symbol_table.isObservedVariable(it->first.first) && symbol_table.isObservedVariable(it->first.second)));
|
||||||
string matrix;
|
string matrix, corr_matrix;
|
||||||
int id1, id2;
|
int id1, id2;
|
||||||
if (type1 == eExogenous)
|
if (type1 == eExogenous)
|
||||||
{
|
{
|
||||||
matrix = "M_.Sigma_e";
|
matrix = "M_.Sigma_e";
|
||||||
|
corr_matrix = "M_.Correlation_matrix";
|
||||||
id1 = symbol_table.getTypeSpecificID(it->first.first) + 1;
|
id1 = symbol_table.getTypeSpecificID(it->first.first) + 1;
|
||||||
id2 = symbol_table.getTypeSpecificID(it->first.second) + 1;
|
id2 = symbol_table.getTypeSpecificID(it->first.second) + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
matrix = "M_.H";
|
matrix = "M_.H";
|
||||||
|
corr_matrix = "M_.Correlation_matrix_ME";
|
||||||
id1 = symbol_table.getObservedVariableIndex(it->first.first) + 1;
|
id1 = symbol_table.getObservedVariableIndex(it->first.first) + 1;
|
||||||
id2 = symbol_table.getObservedVariableIndex(it->first.second) + 1;
|
id2 = symbol_table.getObservedVariableIndex(it->first.second) + 1;
|
||||||
}
|
}
|
||||||
|
@ -178,6 +180,15 @@ ShocksStatement::writeCovarOrCorrShock(ostream &output, covar_and_corr_shocks_t:
|
||||||
output << ";" << endl
|
output << ";" << endl
|
||||||
<< matrix << "(" << id2 << ", " << id1 << ") = "
|
<< matrix << "(" << id2 << ", " << id1 << ") = "
|
||||||
<< matrix << "(" << id1 << ", " << id2 << ");" << endl;
|
<< matrix << "(" << id1 << ", " << id2 << ");" << endl;
|
||||||
|
|
||||||
|
if (corr)
|
||||||
|
{
|
||||||
|
output << corr_matrix << "(" << id1 << ", " << id2 << ") = ";
|
||||||
|
it->second->writeOutput(output);
|
||||||
|
output << ";" << endl
|
||||||
|
<< corr_matrix << "(" << id2 << ", " << id1 << ") = "
|
||||||
|
<< corr_matrix << "(" << id1 << ", " << id2 << ");" << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -47,7 +47,8 @@ ModFileStructure::ModFileStructure() :
|
||||||
dsge_var_estimated(false),
|
dsge_var_estimated(false),
|
||||||
bayesian_irf_present(false),
|
bayesian_irf_present(false),
|
||||||
estimation_data_statement_present(false),
|
estimation_data_statement_present(false),
|
||||||
last_markov_switching_chain(0)
|
last_markov_switching_chain(0),
|
||||||
|
calib_smoother_present(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,8 @@ public:
|
||||||
bool estimation_data_statement_present;
|
bool estimation_data_statement_present;
|
||||||
//! Last chain number for Markov Switching statement
|
//! Last chain number for Markov Switching statement
|
||||||
int last_markov_switching_chain;
|
int last_markov_switching_chain;
|
||||||
|
//! Whether a calib_smoother statement is present
|
||||||
|
bool calib_smoother_present;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Statement
|
class Statement
|
||||||
|
|
Loading…
Reference in New Issue