The residuals of the static equations is not zero

It looks like the residuals of the static equations is not zero,but i don’t why. I’m confused about the value of tax_w, I can only get equation 18 to 0 if I set tax_w endogenously using the stabilization equation, whereas I actually set it exogenously because it is income tax. What puzzles me the most is that the sum of Equation 16 and Equation 23 is 0. They are actually consumption constraints.I am a newbie in dynare, I hope anyone can help me, I am building a tank model, but there may be some problems to some extent.

console_tmp.m (2.1 KB)
tmp.mod (4.8 KB)
Foc.pdf (903.1 KB)

Did you forget to upload your solve_TG function? Cannot find it actually. In any case, when residuals are not zero, I typically check steady state values of each variables. In most cases it reveals the problem.

First of all, thanks for your reply. I’m very sorry, this is an oversight on my part. Since TG cannot be written in analytical form, I performed a numerical solution. I checked various steady state values but still can’t find the problem.
solve_TG.m (560 Bytes)

what is the role of the variable d?

The residuals are not zero.
It may be due to the steady state values or you did not write your equations correctly.

This is actually the variable b (treasury bond), because it is a nominal variable. In order to remove the non-stationary price p, so i defined d=b/p.

Thanks for your reply, i will check it again.There must be some error in the steady-state value.

Check the balance sheet equations 16 and 23. Residuals are equal and opposite. So something is not adding up. Also don’t use external solver here. It will be prone to error. Use STEADY_STATE() command instead to use the steady state value of Tg.

Thank you very much for your help, I will try it immediately.

Hi, i am back. At last i solve the problem, let me briefly describe my experience, which is all related to Walras’ law. In my code, I included the budget constraints of both households and the corresponding market equilibrium (actually there is an extra equation here). However, in order to make the number of endogenous variables and equations equal, I deleted production function (so there is one less equation). After this was resolved, the model again had collinearity issues since my heterogeneous households were actually similar, so I changed the households to, Ricardian and non-Ricardian households. Finally I did it, thanks to those who helped me before.