Greetings: Currently I’m trying to simulate a stochastic DSGE model with both RBC and NK components, as specified by Suescun and Steiner (2017) at Fedesarrollo. The version of the model I’m running is a de-trended one, so I can use stochastic simulation, and steady commands.

After fixing syntax errors, and dismissing some unused variables/parameters, we encounter with the error:

Substitution of endo lags >= 2: added 3 auxiliary variables and equations.
Substitution of exo lags: added 3 auxiliary variables and equations.
ERROR: There are 90 equations but 89 endogenous variables!

I’d be grateful if you could provide me some hints or sights on this errors. Ultimately, my objective is to be able to run the model successfully and get irfs and in general Dynare output. I provide you with the .mod file and the logs when invoking Dynare.

That simply means that you have one equation too much in your model. I count 83 declared variables but 84 entered equations. So one equation is redundant.

Substitution of endo lags >= 2: added 3 auxiliary variables and equations.
Substitution of exo lags: added 3 auxiliary variables and equations.

arise because you have written a model which is not a system of first order expectational difference equations. For example, you have the variables k_O_1, k_O_2, and k_O_3 entering with a two period lag (lines 425, 443, and 461). I’m guessing this is why you get the message related to exogenous variables as well.

Here Dynare is fixing a computational difficulty for you by creating appropriate auxiliary variables to ensure you can write the entire system as a first order expectational difference equation. I would encourage you to think about how you could cast the model in this form yourself, but it is is not the addition of these auxiliary variables which is causing the problem.

The third message

ERROR: There are 90 equations but 89 endogenous variables!

is the problem. As @jpfeifer’s comment notes, you declared 83 variables and wrote 84 equations. Since the error message doesn’t complain about an undeclared variable, it must be that you have included too many equations.

My conjecture is that you have included both an aggregate resource constraint and a household budget constraint, but it could be any number of things.