Error backtrace

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 (21.7 KB)

You cannot use the macroprocessor to run Matlab if clauses like

@#if any(isnan(robs))

That part needs to be Matlab code.

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

I would need to see the code.

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 (19.9 KB)

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

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 (21.2 KB)

See

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

The name of the set parameters is different.

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 (21.1 KB)

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

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

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.

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 (21.1 KB)

Take

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.

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 (21.2 KB)

No, for example

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

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

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 (21.1 KB)

The equation is:

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

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


and that equation is making it difficult for me to fully realize the model. thanks for your help!!!