Reactivate and fix the test for the balanced growth path.
If the homogeneized equation evaluates to zero, then we skip the test (otherwise the 2nd derivative of the log is infinite, and the test fails while it should not necessarily). Closes #506time-shift
parent
4e7806d71c
commit
f889760f61
|
@ -3757,8 +3757,13 @@ DynamicModel::testTrendDerivativesEqualToZero(const eval_context_t &eval_context
|
|||
|| symbol_table.getType(it->first.first) == eLogTrend)
|
||||
for (int eq = 0; eq < (int) equations.size(); eq++)
|
||||
{
|
||||
expr_t testeq = AddLog(AddMinus(equations[eq]->get_arg1(), // F: a = b -> ln(a - b)
|
||||
equations[eq]->get_arg2()));
|
||||
expr_t homogeneq = AddMinus(equations[eq]->get_arg1(),
|
||||
equations[eq]->get_arg2())
|
||||
|
||||
// Do not run the test if the term inside the log is zero
|
||||
if (fabs(homogeneq->eval(eval_context)) > ZERO_BAND)
|
||||
{
|
||||
expr_t testeq = AddLog(homogeneq); // F = log(lhs-rhs)
|
||||
testeq = testeq->getDerivative(it->second); // d F / d Trend
|
||||
for (deriv_id_table_t::const_iterator endogit = deriv_id_table.begin();
|
||||
endogit != deriv_id_table.end(); endogit++)
|
||||
|
@ -3775,6 +3780,7 @@ DynamicModel::testTrendDerivativesEqualToZero(const eval_context_t &eval_context
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DynamicModel::writeParamsDerivativesFile(const string &basename) const
|
||||
|
@ -4134,8 +4140,9 @@ DynamicModel::transformPredeterminedVariables()
|
|||
void
|
||||
DynamicModel::detrendEquations()
|
||||
{
|
||||
for (nonstationary_symbols_map_t::const_iterator it = nonstationary_symbols_map.begin();
|
||||
it != nonstationary_symbols_map.end(); it++)
|
||||
// We go backwards in the list of trend_vars, to deal correctly with I(2) processes
|
||||
for (nonstationary_symbols_map_t::const_reverse_iterator it = nonstationary_symbols_map.rbegin();
|
||||
it != nonstationary_symbols_map.rend(); ++it)
|
||||
for (int i = 0; i < (int) equations.size(); i++)
|
||||
{
|
||||
BinaryOpNode *substeq = dynamic_cast<BinaryOpNode *>(equations[i]->detrend(it->first, it->second.first, it->second.second));
|
||||
|
|
|
@ -416,8 +416,8 @@ ModFile::computingPass(bool no_tmp_terms)
|
|||
// Mod file may have no equation (for example in a standalone BVAR estimation)
|
||||
if (dynamic_model.equation_number() > 0)
|
||||
{
|
||||
/*if (nonstationary_variables)
|
||||
trend_dynamic_model.runTrendTest(global_eval_context);*/
|
||||
if (nonstationary_variables)
|
||||
trend_dynamic_model.runTrendTest(global_eval_context);
|
||||
|
||||
// Compute static model and its derivatives
|
||||
dynamic_model.toStatic(static_model);
|
||||
|
|
Loading…
Reference in New Issue