ramsey_{model,policy}, discretionary_policy: check that instruments are declared endogenous

Closes: #72
pac-components
Sébastien Villemot 2021-09-21 17:17:36 +02:00
parent 3d215020ae
commit b12746190d
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 18 additions and 0 deletions

View File

@ -2038,6 +2038,12 @@ ParsingDriver::ramsey_model()
else if (planner_discount)
error("ramsey_model: the 'planner_discount' option cannot be used when the 'optimal_policy_discount_factor' parameter is explicitly declared.");
// Check that instruments are declared endogenous (#72)
if (auto it = options_list.symbol_list_options.find("instruments");
it != options_list.symbol_list_options.end())
for (const auto &s : it->second.getSymbols())
check_symbol_is_endogenous(s);
mod_file->addStatement(make_unique<RamseyModelStatement>(options_list));
options_list.clear();
planner_discount = nullptr;
@ -2059,6 +2065,12 @@ ParsingDriver::ramsey_policy()
else if (planner_discount)
error("ramsey_policy: the 'planner_discount' option cannot be used when the 'optimal_policy_discount_factor' parameter is explicitly declared.");
// Check that instruments are declared endogenous (#72)
if (auto it = options_list.symbol_list_options.find("instruments");
it != options_list.symbol_list_options.end())
for (const auto &s : it->second.getSymbols())
check_symbol_is_endogenous(s);
mod_file->addStatement(make_unique<RamseyPolicyStatement>(mod_file->symbol_table,
symbol_list, options_list));
options_list.clear();
@ -2114,6 +2126,12 @@ ParsingDriver::discretionary_policy()
planner_discount = data_tree->One;
init_param("optimal_policy_discount_factor", planner_discount);
// Check that instruments are declared endogenous (#72)
if (auto it = options_list.symbol_list_options.find("instruments");
it != options_list.symbol_list_options.end())
for (const auto &s : it->second.getSymbols())
check_symbol_is_endogenous(s);
mod_file->addStatement(make_unique<DiscretionaryPolicyStatement>(symbol_list, options_list));
symbol_list.clear();
options_list.clear();