move validation check from constructor to checkpass

time-shift
Houtan Bastani 2010-06-18 15:09:47 +02:00
parent bb47d78611
commit b5baf45f36
1 changed files with 12 additions and 11 deletions

View File

@ -351,15 +351,6 @@ EstimatedParamsStatement::EstimatedParamsStatement(const vector<EstimationParams
estim_params_list(estim_params_list_arg), estim_params_list(estim_params_list_arg),
symbol_table(symbol_table_arg) symbol_table(symbol_table_arg)
{ {
for (vector<EstimationParams>::const_iterator it = estim_params_list.begin();
it != estim_params_list.end(); it++)
if (it->prior == "1") //BETA_PDF is associated with "1" in DynareBison.yy
if (dynamic_cast<NumConstNode *>(it->mean)->isNumConstNodeEqualTo(0.5) &&
dynamic_cast<NumConstNode *>(it->std)->isNumConstNodeEqualTo(0.5))
{
cerr << "ERROR: The prior density is not defined for the beta distribution when the mean = standard deviation = 0.5." << endl;
exit(EXIT_FAILURE);
}
} }
void void
@ -367,8 +358,18 @@ EstimatedParamsStatement::checkPass(ModFileStructure &mod_file_struct)
{ {
for (vector<EstimationParams>::const_iterator it = estim_params_list.begin(); for (vector<EstimationParams>::const_iterator it = estim_params_list.begin();
it != estim_params_list.end(); it++) it != estim_params_list.end(); it++)
if (it->name == "dsge_prior_weight") {
mod_file_struct.dsge_prior_weight_in_estimated_params = true; if (it->name == "dsge_prior_weight")
mod_file_struct.dsge_prior_weight_in_estimated_params = true;
if (it->prior == "1") //BETA_PDF is associated with "1" in DynareBison.yy
if (dynamic_cast<NumConstNode *>(it->mean)->isNumConstNodeEqualTo(0.5) &&
dynamic_cast<NumConstNode *>(it->std)->isNumConstNodeEqualTo(0.5))
{
cerr << "ERROR: The prior density is not defined for the beta distribution when the mean = standard deviation = 0.5." << endl;
exit(EXIT_FAILURE);
}
}
} }
void void