From ba889e853c284b3e4c7879c0946fabc504b53500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Mon, 18 Mar 2013 11:12:49 +0100 Subject: [PATCH] Preprocessor interface and documentation for endogenous_prior option Closes #321 --- doc/dynare.texi | 10 ++++++++++ mex/sources/estimation/logMHMCMCposterior.cc | 3 +++ mex/sources/estimation/logposterior.cc | 3 +++ preprocessor/DynareBison.yy | 4 +++- preprocessor/DynareFlex.ll | 1 + 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/doc/dynare.texi b/doc/dynare.texi index 42fed243e..3647a824e 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -4406,6 +4406,10 @@ missing observations. @item ar = @var{INTEGER} @xref{ar}. Only useful in conjuction with option @code{moments_varendo}. +@item endogenous_prior +Use endogenous priors as in @cite{Christiano, Trabandt and Walentin +(2011)}. + @end table @customhead{Note} @@ -7671,6 +7675,12 @@ Expansion Approach to Simulation of Stochastic Forward-Looking Models with an Application to a Non-Linear Phillips Curve,'' @i{Computational Economics}, 17, 125--139 +@item +Christiano, Lawrence J., Mathias Trabandt and Karl Walentin (2011): +``Introducing financial frictions and unemployment into a small open +economy model,'' @i{Journal of Economic Dynamics and Control}, 35(12), +1999--2041 + @item Dennis, Richard (2007): ``Optimal Policy In Rational Expectations Models: New Solution Algorithms,'' @i{Macroeconomic Dynamics}, 11(1), diff --git a/mex/sources/estimation/logMHMCMCposterior.cc b/mex/sources/estimation/logMHMCMCposterior.cc index 68a519b61..1db19cb63 100644 --- a/mex/sources/estimation/logMHMCMCposterior.cc +++ b/mex/sources/estimation/logMHMCMCposterior.cc @@ -643,6 +643,9 @@ logMCMCposterior(VectorConstView &estParams, const MatrixConstView &data, if (loglinear == 1) throw LogMHMCMCposteriorMexErrMsgTxtException("Option loglinear is not supported"); + if (*mxGetPr(mxGetField(options_, 0, "endogenous_prior")) == 1) + throw LogMHMCMCposteriorMexErrMsgTxtException("Option endogenous_prior is not supported"); + double with_trend = *mxGetPr(mxGetField(bayestopt_, 0, "with_trend")); if (with_trend == 1) throw LogMHMCMCposteriorMexErrMsgTxtException("Observation trends are not supported"); diff --git a/mex/sources/estimation/logposterior.cc b/mex/sources/estimation/logposterior.cc index 4fad4e2f8..04cff9ae6 100644 --- a/mex/sources/estimation/logposterior.cc +++ b/mex/sources/estimation/logposterior.cc @@ -110,6 +110,9 @@ logposterior(VEC1 &estParams, const MatrixConstView &data, if (loglinear == 1) throw LogposteriorMexErrMsgTxtException("Option loglinear is not supported"); + if (*mxGetPr(mxGetField(options_, 0, "endogenous_prior")) == 1) + throw LogposteriorMexErrMsgTxtException("Option endogenous_prior is not supported"); + double with_trend = *mxGetPr(mxGetField(bayestopt_, 0, "with_trend")); if (with_trend == 1) throw LogposteriorMexErrMsgTxtException("Observation trends are not supported"); diff --git a/preprocessor/DynareBison.yy b/preprocessor/DynareBison.yy index 546b65ced..9165dfc64 100644 --- a/preprocessor/DynareBison.yy +++ b/preprocessor/DynareBison.yy @@ -97,7 +97,7 @@ class ParsingDriver; %token BVAR_REPLIC BYTECODE ALL_VALUES_REQUIRED %token CALIB_SMOOTHER CHANGE_TYPE CHECK CONDITIONAL_FORECAST CONDITIONAL_FORECAST_PATHS CONF_SIG CONSTANT CONTROLLED_VAREXO CORR COVAR CUTOFF CYCLE_REDUCTION LOGARITHMIC_REDUCTION %token DATAFILE FILE DETERMINISTIC DOUBLING DR_CYCLE_REDUCTION_TOL DR_LOGARITHMIC_REDUCTION_TOL DR_LOGARITHMIC_REDUCTION_MAXITER DR_ALGO DROP DSAMPLE DYNASAVE DYNATYPE CALIBRATION -%token END ENDVAL EQUAL ESTIMATION ESTIMATED_PARAMS ESTIMATED_PARAMS_BOUNDS ESTIMATED_PARAMS_INIT EXTENDED_PATH +%token END ENDVAL EQUAL ESTIMATION ESTIMATED_PARAMS ESTIMATED_PARAMS_BOUNDS ESTIMATED_PARAMS_INIT EXTENDED_PATH ENDOGENOUS_PRIOR %token FILENAME FILTER_STEP_AHEAD FILTERED_VARS FIRST_OBS LAST_OBS SET_TIME %token FLOAT_NUMBER %token DEFAULT FIXED_POINT @@ -1536,6 +1536,7 @@ estimation_options : o_datafile | o_dr_logarithmic_reduction_maxiter | o_analytic_derivation | o_ar + | o_endogenous_prior ; list_optim_option : QUOTED_STRING COMMA QUOTED_STRING @@ -2626,6 +2627,7 @@ o_regime : REGIME EQUAL INT_NUMBER { driver.option_num("ms.regime",$3); }; o_data_obs_nbr : DATA_OBS_NBR EQUAL INT_NUMBER { driver.option_num("ms.forecast_data_obs",$3); }; o_discretionary_tol: DISCRETIONARY_TOL EQUAL non_negative_number { driver.option_num("discretionary_tol",$3); }; o_analytic_derivation : ANALYTIC_DERIVATION { driver.option_num("analytic_derivation", "1"); } +o_endogenous_prior : ENDOGENOUS_PRIOR { driver.option_num("endogenous_prior", "1"); } range : symbol ':' symbol { diff --git a/preprocessor/DynareFlex.ll b/preprocessor/DynareFlex.ll index 897597b10..a86ab4e4e 100644 --- a/preprocessor/DynareFlex.ll +++ b/preprocessor/DynareFlex.ll @@ -472,6 +472,7 @@ string eofbuff; discretionary_tol {return token::DISCRETIONARY_TOL;} analytic_derivation {return token::ANALYTIC_DERIVATION;} solver_periods {return token::SOLVER_PERIODS;} +endogenous_prior {return token::ENDOGENOUS_PRIOR;} [\$][^$]*[\$] { strtok(yytext+1, "$");