# Error backtrace

**URL:** <https://forum.dynare.org/t/error-backtrace/24829>\
**Category:** ML/Bayesian estimation\
**Created:** [24 December 2023 19:27 UTC](https://forum.dynare.org/t/error-backtrace/24829 "2023-12-24T19:27:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arielcamen](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/90ced4/32.png) [@Arielcamen](https://forum.dynare.org/u/Arielcamen)\
**Post date:** [24 December 2023 19:27 UTC](https://forum.dynare.org/t/error-backtrace/24829/1 "2023-12-24T19:27:30Z")

</div>

Hello everyone, when trying to run a code to replicate, iget the following message:

Macro-processing error: backtrace…

- Unknown function any
- Function: “ukmon.mod” line 488, col 5-21
- @#if: “ukmon.mod” line 488, col 1 to line 494, col 7

The file is:  
[ukmon.mod](https://forum.dynare.org/uploads/short-url/hEB1V7yd0KzTtPBNDeqUK1LOS8B.mod) (21.7 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [27 December 2023 08:59 UTC](https://forum.dynare.org/t/error-backtrace/24829/2 "2023-12-27T08:59:12Z")

</div>

You cannot use the macroprocessor to run Matlab if clauses like

```auto
@#if any(isnan(robs))

```

That part needs to be Matlab code.

---

<div class="post-metadata">

**Author:** ![Arielcamen](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/90ced4/32.png) [@Arielcamen](https://forum.dynare.org/u/Arielcamen)\
**Post date:** [10 January 2024 02:02 UTC](https://forum.dynare.org/t/error-backtrace/24829/3 "2024-01-10T02:02:52Z")

</div>

Thanks, another question, what causes the unexpected POWER error?

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [10 January 2024 08:09 UTC](https://forum.dynare.org/t/error-backtrace/24829/4 "2024-01-10T08:09:47Z")

</div>

I would need to see the code.

---

<div class="post-metadata">

**Author:** ![Arielcamen](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/90ced4/32.png) [@Arielcamen](https://forum.dynare.org/u/Arielcamen)\
**Post date:** [11 January 2024 01:42 UTC](https://forum.dynare.org/t/error-backtrace/24829/5 "2024-01-11T01:42:40Z")

</div>

Thanks, I managed to correct that error, however, now I have a new one: the number of equations marked [static] must be equal to the number of equations marked [dynamic] the model code is this:  
[ukpol.mod](https://forum.dynare.org/uploads/short-url/1XHHIkc87WCx9QZpxLaw4W9qn6.mod) (19.9 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [11 January 2024 07:50 UTC](https://forum.dynare.org/t/error-backtrace/24829/6 "2024-01-11T07:50:48Z")

</div>

Every pair of OccBin equations with the `bind` and `relax` tag must have an identical `name` tag. You cannot tag them `a` and `b`.

---

<div class="post-metadata">

**Author:** ![Arielcamen](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/90ced4/32.png) [@Arielcamen](https://forum.dynare.org/u/Arielcamen)\
**Post date:** [13 January 2024 01:03 UTC](https://forum.dynare.org/t/error-backtrace/24829/7 "2024-01-13T01:03:50Z")

</div>

Thank you professor, I made the modification and the problem was solved. Finally, this series of errors appear:

Error using print\_info  
The steady state has NaNs or Inf.

Error in steady (line 102)  
print\_info(info,options\_.noprint, options\_);

Error in ukpol.driver (line 885)  
steady;

Error in dynare (line 281)  
evalin(‘base’,[fname ‘.driver’]);

[ukpol.mod](https://forum.dynare.org/uploads/short-url/pqLiIsIx4kVO0wLugfTSyUM4j1g.mod) (21.2 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [15 January 2024 18:27 UTC](https://forum.dynare.org/t/error-backtrace/24829/8 "2024-01-15T18:27:34Z")

</div>

See

> Some of the parameters have no value (iotp, iotw, consr) when using steady.

The name of the set parameters is different.

---

<div class="post-metadata">

**Author:** ![Arielcamen](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/90ced4/32.png) [@Arielcamen](https://forum.dynare.org/u/Arielcamen)\
**Post date:** [18 January 2024 02:11 UTC](https://forum.dynare.org/t/error-backtrace/24829/9 "2024-01-18T02:11:26Z")

</div>

Thank you very much for your help, the last error that appears to me is that the steady state cannot be obtained: Error using print\_info  
Impossible to find the steady state (the sum of squared residuals of the static equations is 105819.6024). Either the model doesn’t have a steady state, there are an infinity of steady states, or the guess values are too far from the solution.

[ukpol.mod](https://forum.dynare.org/uploads/short-url/40HUR6U29hphoVwZEfKXYXOoSHh.mod) (21.1 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [19 January 2024 08:11 UTC](https://forum.dynare.org/t/error-backtrace/24829/10 "2024-01-19T08:11:35Z")

</div>

It seems your model is supposed to be linear. But there are three nonlinear equations and the initial values are not zero.

---

<div class="post-metadata">

**Author:** ![Arielcamen](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/90ced4/32.png) [@Arielcamen](https://forum.dynare.org/u/Arielcamen)\
**Post date:** [20 January 2024 02:34 UTC](https://forum.dynare.org/t/error-backtrace/24829/11 "2024-01-20T02:34:13Z")

</div>

Thank you, a question about how you performed a diagnosis of the 3 nonlinear equations. And how to solve it?

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [22 January 2024 08:11 UTC](https://forum.dynare.org/t/error-backtrace/24829/12 "2024-01-22T08:11:27Z")

</div>

1.I added the `linear` keyword to `model(linear)`. Dynare will then perform a check.  
2. You need to check your linearization. It must be wrong.

---

<div class="post-metadata">

**Author:** ![Arielcamen](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/90ced4/32.png) [@Arielcamen](https://forum.dynare.org/u/Arielcamen)\
**Post date:** [27 January 2024 01:05 UTC](https://forum.dynare.org/t/error-backtrace/24829/13 "2024-01-27T01:05:46Z")

</div>

I perform the addition of the keyword, and dynare shows me the 3 non linear equations pointing out the following error: If the model is declared linear the second derivatives must be equal to zero.  
The following equations have non-zero second derivatives:  
\* Eq # 5 [Output produced using capital and labor services eq.(5)]  
\* Eq # 11 [Real lending rate eq.(11)]  
\* Eq # 20 [Evolution of foreign bonds eq.(20)]

And I suppose the error is related to “rk”. Although I am not sure if that is it. Thanks for your help.  
[ukpol.mod](https://forum.dynare.org/uploads/short-url/x3t8BQgjwrzC9xIhZrhy7NGyaua.mod) (21.1 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [29 January 2024 11:37 UTC](https://forum.dynare.org/t/error-backtrace/24829/14 "2024-01-29T11:37:56Z")

</div>

Take

```auto
y = phip*((alfa*k(-1))+alfa*(1-cpsi/cpsi)*rk+(1-alfa))*lab+a;

```

for example seems to have wrong bracketing, resulting in various variables multiplying `lab`.

---

<div class="post-metadata">

**Author:** ![Arielcamen](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/90ced4/32.png) [@Arielcamen](https://forum.dynare.org/u/Arielcamen)\
**Post date:** [6 February 2024 04:29 UTC](https://forum.dynare.org/t/error-backtrace/24829/15 "2024-02-06T04:29:08Z")

</div>

Hello, thank you very much for your attention, make the modification you suggested and only eliminate that equation from the error. Check out the other two that dynare points out and compare them to the article I’m replicating. However, it continues to appear and according to my review the equations are fine. In addition, it now shows the following legend:  
Finding the optimal block decomposition of the static model…  
22 block(s) found:  
18 recursive block(s) and 4 simultaneous block(s).  
the largest simultaneous block has 13 equation(s)  
and 13 feedback variable(s).  
Computing dynamic model derivatives (order 2).  
Normalizing the dynamic model…  
Finding the optimal block decomposition of the dynamic model…  
5 block(s) found:  
2 recursive block(s) and 3 simultaneous block(s).  
the largest simultaneous block has 21 equation(s)  
and 20 feedback variable(s).  
ERROR: If the model is linear declared the second derivatives must be equal to zero.  
The following equations have non-zero second derivatives:  
\* Eq # 11 [Real lending rate eq.(11)]

Thank you very much for your help!  
[ukpol.mod](https://forum.dynare.org/uploads/short-url/uHV7gC2ciE1TYlzTrMBhwY662Rd.mod) (21.2 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [6 February 2024 12:22 UTC](https://forum.dynare.org/t/error-backtrace/24829/16 "2024-02-06T12:22:34Z")

</div>

No, for example

```auto
cy = ((rk+(1-delt)*pk)/pk(-1));

```

contains a division by a variable and is therefore not linear.

---

<div class="post-metadata">

**Author:** ![Arielcamen](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/90ced4/32.png) [@Arielcamen](https://forum.dynare.org/u/Arielcamen)\
**Post date:** [15 February 2024 02:16 UTC](https://forum.dynare.org/t/error-backtrace/24829/17 "2024-02-15T02:16:20Z")

</div>

Review the list of the log linearized equations of the model and indeed equation 11 is not in it, it is duplicated with equation 3 of the capital arbitrage condition. By removing number 11 from the model, and the variable c and sending it to the exogenous section, only equation 19 “evolution of foreign bonds” remains with error:  
ERROR: If the model is linear declared the second derivatives must be equal to zero.  
The following equations have non-zero second derivatives:  
\* Eq # 19 [Evolution of foreign bonds eq.(19)]  
[prueba.mod](https://forum.dynare.org/uploads/short-url/4baAxXECn7AXB0nymSrrCH14D86.mod) (21.1 KB)

---

<div class="post-metadata">

**Author:** ![Arielcamen](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/90ced4/32.png) [@Arielcamen](https://forum.dynare.org/u/Arielcamen)\
**Post date:** [15 February 2024 02:17 UTC](https://forum.dynare.org/t/error-backtrace/24829/18 "2024-02-15T02:17:24Z")

</div>

The equation is:

 ![image](https://forum.dynare.org/uploads/default/original/3X/2/7/2707cca85e3b9d51a7ff8bf1c5bda600d90f3680.png)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [15 February 2024 07:49 UTC](https://forum.dynare.org/t/error-backtrace/24829/19 "2024-02-15T07:49:11Z")

</div>

You can immediately see that that equation cannot be correct. It is not linear.

---

<div class="post-metadata">

**Author:** ![Arielcamen](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/90ced4/32.png) [@Arielcamen](https://forum.dynare.org/u/Arielcamen)\
**Post date:** [26 March 2024 00:27 UTC](https://forum.dynare.org/t/error-backtrace/24829/20 "2024-03-26T00:27:23Z")

</div>

In the article I am trying to replicate it is assumed that the equation is log linearized. As seen in the image:

 ![image](https://forum.dynare.org/uploads/default/original/3X/5/e/5e03a47e1c024835ead31e0d287c14182e281d2c.png)  
and that equation is making it difficult for me to fully realize the model. thanks for your help!!!

[Next page](https://forum.dynare.org/t/error-backtrace/24829.md?page=2)
