From 4fc785f8d5cac4b253046145ad22a8af073ec35a Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Fri, 12 Dec 2014 18:02:07 +0100
Subject: [PATCH] preprocessor: add weibull and weibull_pdf options for
estimation and new estimation, #520
---
CodeInterpreter.hh | 3 ++-
ComputingTasks.cc | 3 +++
DynareBison.yy | 6 +++++-
DynareFlex.ll | 5 +++++
4 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/CodeInterpreter.hh b/CodeInterpreter.hh
index d39567b8..b95908f5 100644
--- a/CodeInterpreter.hh
+++ b/CodeInterpreter.hh
@@ -246,7 +246,8 @@ enum PriorDistributions
eInvGamma1 = 4,
eUniform = 5,
eInvGamma2 = 6,
- eDirichlet = 7
+ eDirichlet = 7,
+ eWeibull = 8
};
struct Block_contain_type
diff --git a/ComputingTasks.cc b/ComputingTasks.cc
index e22f1577..f518f50c 100644
--- a/ComputingTasks.cc
+++ b/ComputingTasks.cc
@@ -2221,6 +2221,9 @@ BasicPriorStatement::writeCShape(ostream &output) const
case eDirichlet:
output << "\"dirichlet\";" << endl;
break;
+ case eWeibull:
+ output << "\"weibull\";" << endl;
+ break;
case eNoShape:
assert(prior_shape != eNoShape);
}
diff --git a/DynareBison.yy b/DynareBison.yy
index a9280120..45b5b8ec 100644
--- a/DynareBison.yy
+++ b/DynareBison.yy
@@ -148,7 +148,7 @@ class ParsingDriver;
%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 <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 DIRICHLET
-%token GSIG2_LMDM Q_DIAG FLAT_PRIOR NCSK NSTD
+%token GSIG2_LMDM Q_DIAG FLAT_PRIOR NCSK NSTD WEIBULL WEIBULL_PDF
%token INDXPARR INDXOVR INDXAP APBAND INDXIMF IMFBAND INDXFORE FOREBAND INDXGFOREHAT INDXGIMFHAT
%token INDXESTIMA INDXGDLS EQ_MS FILTER_COVARIANCE FILTER_DECOMPOSITION
%token EQ_CMS TLINDX TLNUMBER BANACT RESTRICTIONS
@@ -1330,6 +1330,8 @@ prior_distribution : BETA
{ $$ = eInvGamma2; }
| DIRICHLET
{ $$ = eDirichlet; }
+ | WEIBULL
+ { $$ = eWeibull; }
;
prior_pdf : BETA_PDF
@@ -1346,6 +1348,8 @@ prior_pdf : BETA_PDF
{ $$ = eUniform; }
| INV_GAMMA2_PDF
{ $$ = eInvGamma2; }
+ | WEIBULL_PDF
+ { $$ = eWeibull; }
;
date_str : DATES { $$ = $1; }
diff --git a/DynareFlex.ll b/DynareFlex.ll
index 9052a102..f84686a0 100644
--- a/DynareFlex.ll
+++ b/DynareFlex.ll
@@ -402,6 +402,10 @@ 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::DIRICHLET;
}
+<DYNARE_STATEMENT>weibull {
+ yylval->string_val = new string(yytext);
+ return token::WEIBULL;
+}
<DYNARE_STATEMENT>normal {
yylval->string_val = new string(yytext);
return token::NORMAL;
@@ -587,6 +591,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_BLOCK>inv_gamma1_pdf {return token::INV_GAMMA1_PDF;}
<DYNARE_BLOCK>inv_gamma2_pdf {return token::INV_GAMMA2_PDF;}
<DYNARE_BLOCK>uniform_pdf {return token::UNIFORM_PDF;}
+<DYNARE_BLOCK>weibull_pdf {return token::WEIBULL_PDF;}
<DYNARE_BLOCK>dsge_prior_weight {return token::DSGE_PRIOR_WEIGHT;}
<DYNARE_BLOCK>; {return Dynare::parser::token_type (yytext[0]);}
--
GitLab