diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc index 192e436bab30586d06002a1f94ef3cb7b631bd66..345c6e1d0ace5aa23f5017fea4b5a469a1d216ec 100644 --- a/src/DynamicModel.cc +++ b/src/DynamicModel.cc @@ -5546,18 +5546,28 @@ DynamicModel::detrendEquations() // We go backwards in the list of trend_vars, to deal correctly with I(2) processes for (auto it = nonstationary_symbols_map.crbegin(); it != nonstationary_symbols_map.crend(); ++it) - for (auto &equation : equations) - { - auto substeq = dynamic_cast<BinaryOpNode *>(equation->detrend(it->first, it->second.first, it->second.second)); - assert(substeq); - equation = dynamic_cast<BinaryOpNode *>(substeq); - } + { + for (auto &equation : equations) + { + equation = dynamic_cast<BinaryOpNode *>(equation->detrend(it->first, it->second.first, it->second.second)); + assert(equation); + } + for (auto &equation : static_only_equations) + { + equation = dynamic_cast<BinaryOpNode *>(equation->detrend(it->first, it->second.first, it->second.second)); + assert(equation); + } + } for (auto &equation : equations) { - auto substeq = dynamic_cast<BinaryOpNode *>(equation->removeTrendLeadLag(trend_symbols_map)); - assert(substeq); - equation = dynamic_cast<BinaryOpNode *>(substeq); + equation = dynamic_cast<BinaryOpNode *>(equation->removeTrendLeadLag(trend_symbols_map)); + assert(equation); + } + for (auto &equation : static_only_equations) + { + equation = dynamic_cast<BinaryOpNode *>(equation->removeTrendLeadLag(trend_symbols_map)); + assert(equation); } } @@ -5566,9 +5576,13 @@ DynamicModel::removeTrendVariableFromEquations() { for (auto &equation : equations) { - auto substeq = dynamic_cast<BinaryOpNode *>(equation->replaceTrendVar()); - assert(substeq); - equation = dynamic_cast<BinaryOpNode *>(substeq); + equation = dynamic_cast<BinaryOpNode *>(equation->replaceTrendVar()); + assert(equation); + } + for (auto &equation : static_only_equations) + { + equation = dynamic_cast<BinaryOpNode *>(equation->replaceTrendVar()); + assert(equation); } }