# Substitution of endo lags

Dear All
when i run my code, received this error:

Substitution of endo lags >= 2: added 1 auxiliary variables and equations.
ERROR: There are 23 equations but 22 endogenous variables!

But in my model block, i have 22 equation and not 23.
anybody knows what happen?

Best Regards

As Dynare states, it substitutes one variable with a lag of (-2) with an auxiliary variable. That adds one variable and one equation. If you forget about this, you have 22 equations as you said, but you also only have 21 declared variables:

```var m c r w l pi rk mc y a k i g mb dg fr oil p gro_mb pi_star nu; ```

how i run this file?

Find the missing equation.

Hello,

I was just trying to understand how Dynare plugs in variables from one equation to the other while solving the model as I am working to get an analytical solution on my own.

I have the following IS equation, where c, g, t, b, r, pi are endogenous variables:

``````c=delta*c(+1)+(A1*(lambda*(g-g(+1))+(1-s)*(g(+1)))+(A2*(lambda*(t-t(+1))+(1-s)*(t(+1)))+(A3*(lambda*(b(-1)+r(-1)-b-r)+(1-s)*(b+r))-(A4*(r-pi(+1)));

``````

I also have the following equations for t and b in the model,

``````t=rho_tauT*t(-1)+(1-rho_tauT)*((phi_tauT_B*b(-1))+(phi_tauT_G*g))-epsT;

b=((1/betta))*(b(-1)+r(-1))+(Gss/Bss)*(g)-(Tss/Bss)*t;

``````

The model works fine otherwise. I wanted to understand that if it is okay to plug in for t(+1) in the IS equation by taking the equation for ‘t’ one-period-ahead, even though my model originally has the equation for variable ‘t’ in period t.

Also, if I can substitute the equation for ‘t’ in the equation for b, such that these two steps could eliminate the variable ‘t’ in the model.

I was trying to derive a state-space representation analytically for a big model and this clarification would be very helfpul for that. Thank you very much!

As long as the equations are purely backward-looking, they are essentially definitions. It is safe to plug in then as you are not changing the information set.

Thank you very much for the clarification!

I have a 7-equation linear model which works fine, but when I reduce it to 5 equations using the substitutions I mentioned above, the B-K conditions are not satisfied, so I was wondering if what I’m doing is incorrect.

In that case, you must have introduced a mistake somewhere. But what is the point of reducing the number of equations?

Right, I’m checking for mistakes now, thank you very much.

The aim is to get an analytical solution for a big model, so I’m trying to reduce the number of equations to get the simplest possible state-space representation (Although 5 equations would not be very helpful for that goal).

I have the IS equation as:

``````c=delta*c(+1)+(A1*(lambda*(g-g(+1))+(1-s)*(g(+1)))+(A2*(lambda*(t-t(+1))+(1-s)*(t(+1)))+(A3*(lambda*(b(-1)+r(-1)-b-r)+(1-s)*(b+r))-(A4*(r-pi(+1)));
``````

And equations for t and b,

``````t=(phi_tauT_B*b(-1))+(phi_tauT_G*g)-epsT;

b=((1/betta))*(b(-1)+r(-1))+(Gss/Bss)*(g)-(Tss/Bss)*t;
``````

If I substitute the equation for variable ‘t’ in the equation for ‘b’ as I asked in my earlier post above, also plug-in for variable ‘t’ for period (t) as well as (t+1) in the IS equation, I can get rid of variable ‘t’ from the model completely. However, I do remain with epsT and epsT(+1) in doing that.

While I have seen this approach before, I am not sure how to make the state-state form on my own for this. Dynare is treating epsT as a forward-looking and I am not sure if I have come across exogenous variables to be forward-looking. Am I doing something incorrect by doing this?

I would really appreciate your help with this, thank you very much!

Dynare will internally introduce an auxiliary endogenous variable storing the leaded exogenous variable. That allows you to only have contemporaneous shocks in your model setup (essentially the opposite of how news shocks are introduced).

I see, thank you very much!

While writing the model/state-space form on paper myself, is it okay to then ignore these auxiliary variables -like epsT(+1)- or are they still needed for the state-space representation?

No, they are needed.

Thank you very much!