pac: output model type in M_.pac.(model_name)

issue#70
Houtan Bastani 2019-02-20 16:42:22 +01:00
parent 5e1521f42b
commit f88682d683
No known key found for this signature in database
GPG Key ID: 000094FB955BE169
3 changed files with 11 additions and 4 deletions

View File

@ -3657,6 +3657,8 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
if (growth_param_index >= 0)
output << modstruct << "pac." << it.first << ".growth_neutrality_param_index = "
<< symbol_table.getTypeSpecificID(growth_param_index) + 1 << ";" << endl;
output << modstruct << "pac." << it.first << ".auxiliary_model_type = '" << get<2>(it.second) << "';" << endl;
}
for (auto & pit : pac_equation_info)
@ -4606,6 +4608,7 @@ void
DynamicModel::fillPacModelInfo(const string &pac_model_name,
vector<int> lhs,
int max_lag,
string aux_model_type,
const map<pair<string, string>, pair<string, int>> &eqtag_and_lag,
const vector<bool> &nonstationary,
int growth_symb_id, int growth_lag)
@ -4675,7 +4678,7 @@ DynamicModel::fillPacModelInfo(const string &pac_model_name,
pac_expectation_substitution[make_pair(pac_model_name, eqtag)] = subExpr;
}
pac_model_info[pac_model_name] = make_tuple(move(lhs), growth_param_index);
pac_model_info[pac_model_name] = make_tuple(move(lhs), growth_param_index, move(aux_model_type));
}
void

View File

@ -346,6 +346,7 @@ public:
void fillPacModelInfo(const string &pac_model_name,
vector<int> lhs,
int max_lag,
string aux_model_type,
const map<pair<string, string>, pair<string, int>> &eqtag_and_lag,
const vector<bool> &nonstationary,
int growth_symb_id, int growth_lag);
@ -476,8 +477,8 @@ public:
map<pair<string, string>, expr_t> pac_expectation_substitution;
//! Store info about pac models:
//! pac_model_name -> (lhsvars, growth_param_index)
map<string, pair<vector<int>, int>> pac_model_info;
//! pac_model_name -> (lhsvars, growth_param_index, aux_model_type)
map<string, tuple<vector<int>, int, string>> pac_model_info;
//! Store info about pac models specific to the equation they appear in
//! (pac_model_name, standardized_eqtag) ->

View File

@ -421,8 +421,10 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
int max_lag;
vector<int> lhs;
vector<bool> nonstationary;
string aux_model_type = "";
if (trend_component_model_table.isExistingTrendComponentModelName(pms->aux_model_name))
{
aux_model_type = "trend_component";
max_lag = trend_component_model_table.getMaxLag(pms->aux_model_name) + 1;
lhs = dynamic_model.getUndiffLHSForPac(pms->aux_model_name, diff_subst_table);
// All lhs variables in a trend component model are nonstationary
@ -430,6 +432,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
}
else if (var_model_table.isExistingVarModelName(pms->aux_model_name))
{
aux_model_type = "var";
max_lag = var_model_table.getMaxLag(pms->aux_model_name);
lhs = var_model_table.getLhs(pms->aux_model_name);
// nonstationary variables in a VAR are those that are in diff
@ -449,7 +452,7 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, const
dynamic_model.addPacModelConsistentExpectationEquation(pms->name, symbol_table.getID(pms->discount),
eqtag_and_lag, diff_subst_table);
else
dynamic_model.fillPacModelInfo(pms->name, lhs, max_lag,
dynamic_model.fillPacModelInfo(pms->name, lhs, max_lag, aux_model_type,
eqtag_and_lag, nonstationary, pms->growth_symb_id, pms->growth_lag);
dynamic_model.substitutePacExpectation(pms->name);
}