remove need to declare equations nonstationary
parent
9968f5c971
commit
bef7c2a193
|
@ -3771,7 +3771,6 @@ DynamicModel::fillVarModelTable() const
|
|||
{
|
||||
map<string, vector<int>> eqnums, lhsr;
|
||||
map<string, vector<expr_t>> lhs_expr_tr;
|
||||
map<string, vector<bool>> nonstationaryr;
|
||||
map<string, vector<set<pair<int, int>>>> rhsr;
|
||||
map<string, vector<string>> eqtags = var_model_table.getEqTags();
|
||||
|
||||
|
@ -3780,7 +3779,6 @@ DynamicModel::fillVarModelTable() const
|
|||
vector<int> eqnumber, lhs;
|
||||
vector<expr_t> lhs_expr_t;
|
||||
vector<set<pair<int, int>>> rhs;
|
||||
vector<bool> nonstationary;
|
||||
|
||||
for (const auto & eqtag : it.second)
|
||||
{
|
||||
|
@ -3800,17 +3798,6 @@ DynamicModel::fillVarModelTable() const
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
bool nonstationary_bool = false;
|
||||
for (const auto & equation_tag : equation_tags)
|
||||
if (equation_tag.first == eqn)
|
||||
if (equation_tag.second.first == "data_type"
|
||||
&& equation_tag.second.second == "nonstationary")
|
||||
{
|
||||
nonstationary_bool = true;
|
||||
break;
|
||||
}
|
||||
nonstationary.push_back(nonstationary_bool);
|
||||
|
||||
equations[eqn]->get_arg1()->collectDynamicVariables(SymbolType::endogenous, lhs_set);
|
||||
equations[eqn]->get_arg1()->collectDynamicVariables(SymbolType::exogenous, lhs_tmp_set);
|
||||
equations[eqn]->get_arg1()->collectDynamicVariables(SymbolType::parameter, lhs_tmp_set);
|
||||
|
@ -3852,13 +3839,11 @@ DynamicModel::fillVarModelTable() const
|
|||
lhsr[it.first] = lhs;
|
||||
lhs_expr_tr[it.first] = lhs_expr_t;
|
||||
rhsr[it.first] = rhs;
|
||||
nonstationaryr[it.first] = nonstationary;
|
||||
}
|
||||
var_model_table.setEqNums(eqnums);
|
||||
var_model_table.setLhs(lhsr);
|
||||
var_model_table.setRhs(rhsr);
|
||||
var_model_table.setLhsExprT(lhs_expr_tr);
|
||||
var_model_table.setNonstationary(nonstationaryr);
|
||||
|
||||
// Fill AR Matrix
|
||||
map<string, map<tuple<int, int, int>, expr_t>> ARr;
|
||||
|
@ -3955,7 +3940,6 @@ DynamicModel::fillTrendComponentModelTable() const
|
|||
{
|
||||
map<string, vector<int>> eqnums, trend_eqnums, lhsr;
|
||||
map<string, vector<expr_t>> lhs_expr_tr;
|
||||
map<string, vector<bool>> nonstationaryr;
|
||||
map<string, vector<set<pair<int, int>>>> rhsr;
|
||||
map<string, vector<string>> eqtags = trend_component_model_table.getEqTags();
|
||||
map<string, vector<string>> trend_eqtags = trend_component_model_table.getTargetEqTags();
|
||||
|
@ -3988,7 +3972,6 @@ DynamicModel::fillTrendComponentModelTable() const
|
|||
vector<int> eqnumber, lhs;
|
||||
vector<expr_t> lhs_expr_t;
|
||||
vector<set<pair<int, int>>> rhs;
|
||||
vector<bool> nonstationary;
|
||||
|
||||
for (const auto & eqtag : it.second)
|
||||
{
|
||||
|
@ -4008,17 +3991,6 @@ DynamicModel::fillTrendComponentModelTable() const
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
bool nonstationary_bool = false;
|
||||
for (const auto & equation_tag : equation_tags)
|
||||
if (equation_tag.first == eqn)
|
||||
if (equation_tag.second.first == "data_type"
|
||||
&& equation_tag.second.second == "nonstationary")
|
||||
{
|
||||
nonstationary_bool = true;
|
||||
break;
|
||||
}
|
||||
nonstationary.push_back(nonstationary_bool);
|
||||
|
||||
equations[eqn]->get_arg1()->collectDynamicVariables(SymbolType::endogenous, lhs_set);
|
||||
equations[eqn]->get_arg1()->collectDynamicVariables(SymbolType::exogenous, lhs_tmp_set);
|
||||
equations[eqn]->get_arg1()->collectDynamicVariables(SymbolType::parameter, lhs_tmp_set);
|
||||
|
@ -4060,10 +4032,9 @@ DynamicModel::fillTrendComponentModelTable() const
|
|||
lhsr[it.first] = lhs;
|
||||
lhs_expr_tr[it.first] = lhs_expr_t;
|
||||
rhsr[it.first] = rhs;
|
||||
nonstationaryr[it.first] = nonstationary;
|
||||
}
|
||||
trend_component_model_table.setRhs(rhsr);
|
||||
trend_component_model_table.setVals(eqnums, trend_eqnums, lhsr, lhs_expr_tr, nonstationaryr);
|
||||
trend_component_model_table.setVals(eqnums, trend_eqnums, lhsr, lhs_expr_tr);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -423,13 +423,15 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
|
|||
{
|
||||
max_lag = trend_component_model_table.getMaxLag(aux_model_name) + 1;
|
||||
lhs = dynamic_model.getUndiffLHSForPac(aux_model_name, diff_subst_table);
|
||||
nonstationary = trend_component_model_table.getNonstationary(aux_model_name);
|
||||
// All lhs variables in a trend component model are nonstationary
|
||||
nonstationary.insert(nonstationary.end(), trend_component_model_table.getDiff(aux_model_name).size(), true);
|
||||
}
|
||||
else if (var_model_table.isExistingVarModelName(aux_model_name))
|
||||
{
|
||||
max_lag = var_model_table.getMaxLag(aux_model_name);
|
||||
lhs = var_model_table.getLhs(aux_model_name);
|
||||
nonstationary = var_model_table.getNonstationary(aux_model_name);
|
||||
// nonstationary variables in a VAR are those that are in diff
|
||||
nonstationary = var_model_table.getDiff(aux_model_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -43,14 +43,12 @@ TrendComponentModelTable::addTrendComponentModel(string name_arg,
|
|||
|
||||
void
|
||||
TrendComponentModelTable::setVals(map<string, vector<int>> eqnums_arg, map<string, vector<int>> target_eqnums_arg,
|
||||
map<string, vector<int>> lhs_arg,
|
||||
map<string, vector<expr_t>> lhs_expr_t_arg, map<string, vector<bool>> nonstationary_arg)
|
||||
map<string, vector<int>> lhs_arg, map<string, vector<expr_t>> lhs_expr_t_arg)
|
||||
{
|
||||
eqnums = move(eqnums_arg);
|
||||
target_eqnums = move(target_eqnums_arg);
|
||||
lhs = move(lhs_arg);
|
||||
lhs_expr_t = move(lhs_expr_t_arg);
|
||||
nonstationary = move(nonstationary_arg);
|
||||
|
||||
for (const auto &it : eqnums)
|
||||
{
|
||||
|
@ -149,13 +147,6 @@ TrendComponentModelTable::checkModelName(const string &name_arg) const
|
|||
}
|
||||
}
|
||||
|
||||
vector<bool>
|
||||
TrendComponentModelTable::getNonstationary(const string &name_arg) const
|
||||
{
|
||||
checkModelName(name_arg);
|
||||
return nonstationary.find(name_arg)->second;
|
||||
}
|
||||
|
||||
vector<int>
|
||||
TrendComponentModelTable::getNontrendLhs(const string &name_arg) const
|
||||
{
|
||||
|
@ -317,8 +308,8 @@ TrendComponentModelTable::writeOutput(const string &basename, ostream &output) c
|
|||
output << (it >= 0 ? symbol_table.getTypeSpecificID(it) + 1 : -1) << " ";
|
||||
output << "];" << endl
|
||||
<< "M_.trend_component." << name << ".nonstationary = [";
|
||||
for (auto it : nonstationary.at(name))
|
||||
output << (it ? "true" : "false") << " ";
|
||||
for (size_t i = 0; i < diff.at(name).size(); i++)
|
||||
output << "true ";
|
||||
output << "];" << endl;
|
||||
int i = 1;
|
||||
for (const auto &it : rhs.at(name))
|
||||
|
@ -473,13 +464,10 @@ VarModelTable::writeOutput(const string &basename, ostream &output) const
|
|||
for (const auto &it : diff.at(name))
|
||||
output << (it ? "true" : "false") << " ";
|
||||
output << "];" << endl
|
||||
<< "M_.var." << name << ".nonstationary = M_.var." << name << ".diff;" << endl
|
||||
<< "M_.var." << name << ".orig_diff_var = [";
|
||||
for (auto it : orig_diff_var.at(name))
|
||||
output << (it >= 0 ? symbol_table.getTypeSpecificID(it) + 1 : -1) << " ";
|
||||
output << "];" << endl
|
||||
<< "M_.var." << name << ".nonstationary = [";
|
||||
for (auto it : nonstationary.at(name))
|
||||
output << (it ? "true" : "false") << " ";
|
||||
output << "];" << endl;
|
||||
int i = 1;
|
||||
for (const auto &it : rhs.at(name))
|
||||
|
@ -590,18 +578,19 @@ VarModelTable::setLhsExprT(map<string, vector<expr_t>> lhs_expr_t_arg)
|
|||
lhs_expr_t = move(lhs_expr_t_arg);
|
||||
}
|
||||
|
||||
void
|
||||
VarModelTable::setNonstationary(map<string, vector<bool>> nonstationary_arg)
|
||||
{
|
||||
nonstationary = move(nonstationary_arg);
|
||||
}
|
||||
|
||||
map<string, vector<int>>
|
||||
VarModelTable::getEqNums() const
|
||||
{
|
||||
return eqnums;
|
||||
}
|
||||
|
||||
vector<bool>
|
||||
VarModelTable::getDiff(const string &name_arg) const
|
||||
{
|
||||
checkModelName(name_arg);
|
||||
return diff.find(name_arg)->second;
|
||||
}
|
||||
|
||||
vector<int>
|
||||
VarModelTable::getEqNums(const string &name_arg) const
|
||||
{
|
||||
|
@ -656,13 +645,6 @@ VarModelTable::getLhs(const string &name_arg) const
|
|||
return lhs.find(name_arg)->second;
|
||||
}
|
||||
|
||||
vector<bool>
|
||||
VarModelTable::getNonstationary(const string &name_arg) const
|
||||
{
|
||||
checkModelName(name_arg);
|
||||
return nonstationary.find(name_arg)->second;
|
||||
}
|
||||
|
||||
vector<set<pair<int, int>>>
|
||||
VarModelTable::getRhs(const string &name_arg) const
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ private:
|
|||
map<string, vector<string>> eqtags, target_eqtags;
|
||||
map<string, vector<int>> eqnums, target_eqnums, nontarget_eqnums, max_lags, lhs, target_lhs, nontarget_lhs, orig_diff_var;
|
||||
map<string, vector<set<pair<int, int>>>> rhs;
|
||||
map<string, vector<bool>> diff, nonstationary;
|
||||
map<string, vector<bool>> diff;
|
||||
map<string, vector<expr_t>> lhs_expr_t;
|
||||
map<string, vector<int>> target_vars;
|
||||
map<string, map<tuple<int, int, int>, expr_t>> AR; // AR: name -> (eqn, lag, lhs_symb_id) -> expr_t
|
||||
|
@ -72,13 +72,12 @@ public:
|
|||
vector<int> getOrigDiffVar(const string &name_arg) const;
|
||||
map<string, vector<int>> getNonTargetEqNums() const;
|
||||
vector<int> getNonTargetEqNums(const string &name_arg) const;
|
||||
vector<bool> getNonstationary(const string &name_arg) const;
|
||||
vector<int> getNontrendLhs(const string &name_arg) const;
|
||||
vector<int> getTargetLhs(const string &name_arg) const;
|
||||
|
||||
void setVals(map<string, vector<int>> eqnums_arg, map<string, vector<int>> target_eqnums_arg,
|
||||
map<string, vector<int>> lhs_arg,
|
||||
map<string, vector<expr_t>> lhs_expr_t_arg, map<string, vector<bool>> nonstationary_arg);
|
||||
map<string, vector<expr_t>> lhs_expr_t_arg);
|
||||
void setRhs(map<string, vector<set<pair<int, int>>>> rhs_arg);
|
||||
void setMaxLags(map<string, vector<int>> max_lags_arg);
|
||||
void setDiff(map<string, vector<bool>> diff_arg);
|
||||
|
@ -120,7 +119,7 @@ private:
|
|||
map<string, vector<string>> eqtags;
|
||||
map<string, vector<int>> eqnums, max_lags, lhs, orig_diff_var;
|
||||
map<string, vector<set<pair<int, int>>>> rhs;
|
||||
map<string, vector<bool>> diff, nonstationary;
|
||||
map<string, vector<bool>> diff;
|
||||
map<string, vector<expr_t>> lhs_expr_t;
|
||||
map<string, map<tuple<int, int, int>, expr_t>> AR; // AR: name -> (eqn, lag, lhs_symb_id) -> param_expr_t
|
||||
public:
|
||||
|
@ -136,11 +135,11 @@ public:
|
|||
map<string, vector<string>> getEqTags() const;
|
||||
vector<string> getEqTags(const string &name_arg) const;
|
||||
map<string, vector<int>> getEqNums() const;
|
||||
vector<bool> getDiff(const string &name_arg) const;
|
||||
vector<int> getEqNums(const string &name_arg) const;
|
||||
vector<int> getMaxLags(const string &name_arg) const;
|
||||
int getMaxLag(const string &name_arg) const;
|
||||
vector<int> getLhs(const string &name_arg) const;
|
||||
vector<bool> getNonstationary(const string &name_arg) const;
|
||||
map<string, pair<SymbolList, int>> getSymbolListAndOrder() const;
|
||||
vector<set<pair<int, int>>> getRhs(const string &name_arg) const;
|
||||
vector<expr_t> getLhsExprT(const string &name_arg) const;
|
||||
|
@ -149,7 +148,6 @@ public:
|
|||
void setLhs(map<string, vector<int>> lhs_arg);
|
||||
void setRhs(map<string, vector<set<pair<int, int>>>> rhs_arg);
|
||||
void setLhsExprT(map<string, vector<expr_t>> lhs_expr_t_arg);
|
||||
void setNonstationary(map<string, vector<bool>> nonstationary_arg);
|
||||
void setDiff(map<string, vector<bool>> diff_arg);
|
||||
void setMaxLags(map<string, vector<int>> max_lags_arg);
|
||||
void setOrigDiffVar(map<string, vector<int>> orig_diff_var_arg);
|
||||
|
|
Loading…
Reference in New Issue