PAC: add growth correction term for definition of Z₁ in the MCE case

pac-components
Sébastien Villemot 2021-10-25 15:36:22 +02:00
parent 4191cec9aa
commit 5bef185370
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
3 changed files with 10 additions and 4 deletions

View File

@ -4067,7 +4067,8 @@ DynamicModel::declarePacModelConsistentExpectationEndogs(const string &name)
void
DynamicModel::addPacModelConsistentExpectationEquation(const string &name, int discount_symb_id,
const map<pair<string, string>, pair<string, int>> &eqtag_and_lag,
ExprNode::subst_table_t &diff_subst_table)
ExprNode::subst_table_t &diff_subst_table,
expr_t growth)
{
int pac_target_symb_id;
try
@ -4190,7 +4191,11 @@ DynamicModel::addPacModelConsistentExpectationEquation(const string &name, int d
AddMinus(AddTimes(A, AddMinus(const_cast<VariableNode *>(target_base_diff_node), fs)), fp));
addEquation(neweq, -1);
neqs++;
pac_expectation_substitution[{name, eqtag}] = AddVariable(mce_z1_symb_id);
/* The growth correction term is not added to the definition of Z₁
because the latter is recursive. Rather put it at the level of the
substition of pac_expectation operator. */
expr_t growth_correction = growth ? AddTimes(AddVariable(pac_growth_neutrality_params.at(name)), growth) : Zero;
pac_expectation_substitution[{name, eqtag}] = AddPlus(AddVariable(mce_z1_symb_id), growth_correction);
}
cout << "Pac Model Consistent Expectation: added " << neqs << " auxiliary variables and equations for model " << name << "." << endl;
}

View File

@ -582,7 +582,7 @@ public:
//! Add model consistent expectation equation for pac model
void addPacModelConsistentExpectationEquation(const string &name, int discount,
const map<pair<string, string>, pair<string, int>> &eqtag_and_lag,
ExprNode::subst_table_t &diff_subst_table);
ExprNode::subst_table_t &diff_subst_table, expr_t growth);
//! Table to undiff LHS variables for pac vector z
vector<int> getUndiffLHSForPac(const string &aux_model_name,

View File

@ -490,7 +490,8 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, bool
auto eqtag_and_lag = dynamic_model.walkPacParameters(pms->name);
if (pms->aux_model_name.empty())
dynamic_model.addPacModelConsistentExpectationEquation(pms->name, symbol_table.getID(pms->discount),
eqtag_and_lag, diff_subst_table);
eqtag_and_lag, diff_subst_table,
pms->growth);
else
dynamic_model.fillPacModelInfo(pms->name, lhs, max_lag, aux_model_type,
eqtag_and_lag, nonstationary, pms->growth);