I have a big model with financial intermediaries and financial frictions.

I am trying to solve for the Transitional Dynamics from one steady state to a new one, in a deterministic setup, and I would like to account for the non-linearities.

Financial intermediaries cannot go short on their assets, so I have to program some complementary slackness conditions for variables like capital, bonds, and money and the relative multipliers.

What is the best way to program complementary slackness in Dynare?

I tried to replicate the file you attached as it stands, but it didn’t work.
I am using Dynare 4.4.3; maybe I failed in replicating because of an old version of Dynare?
Should I consider to switch to a new version?

I went to the Dynare manual, to understand the correct syntax.
But I am still not sure about the correct way to program it.
Allow me please to ask your help.

Suppose Bonds cannot go negative, and so I have the following equations:

…
lambda* B = 0 %complementary slackness for B
other_equation + lambda = 0 %some other equation where I have the lambda from the slackness
…

As far as B = 0 can be zero, lambda is often non-zero and affects the other_equation

Hello everyone,
Thank you for this question and answer. Can the lmmcp handle 2 inequalities? I am pretty new to Dynare. In the examples I have seen so far, I have only noticed one inequality.

Hello again, I am using the mcp tag for some complementary slackness conditions. In the case where the condition does not bind, and the variable of the condition is set equal to the value within the tag, how would I be able to ensure non-negativity for the other variable, ie the variable in the line below the tag. I am providing an illustration below:

From the example in the link you provided
[name=‘FOC w.r.t. to i’,mcp=‘i>0’]
xi_2*1/siggma=0;

From my understanding, in the case where i is greater than 0, xi_21/siggma=0.
In the case where i is not greater than 0, i is set equal to 0. How do I ensure that xi_21/sigma is not greater than zero?

Is it the case that just adding the mcp tag ensures a non-negative value? Is there anything else that needs to be done when adding the mcp tag?

I am not sure I understand. The complementary slackness condition tells us that if the Lagrange multiplier is non-zero, the constraint is binding and

xi_2*1/siggma=0;

holds with equality. If the constraint is non-binding, the multiplier is 0 and xi_2*1/siggma is unrestricted. Whether xi_2*1/siggma>0 or not depends on how you set up the problem (plus or minus multiplier times constraint). We know that in the optimum, the Lagrange multiplier needs to be positive.

Thank you for this reply. I mean that in the case where the constraint is non-binding, I want to be able to restrict the value to a positive value. In the same way that one could say, consumption has to be positive - I want to be able to restrict certain values to positive, in the case where the constraint is non-binding. Is there a command to restrict values in this way, or at least to get a warning if the value is negative?

Thank you for this response. I have a related question regarding mcp. I added the tags and my code has been working fine, however, I am trying to do a check on the steady states and am running into questions. I calculate the steady states using matlab’s fsolve. I then use these values in the initval and endval blocks. When I run the dynare file, the steady state results it presents match the steady state results from fsolve, however, when I chart these values, only the initvals line up exactly. The endvals are different. Could you advise why?
Additionally, I saw perfect_foresight_solver(lmmcp); in an example, does this mean that without (lmmcp), dynare is ignoring the mcp tag?
Finally, in my mcp tag, I use a variable which is defined within the model block, using the #. When I have perfect_foresight_solver(); the model runs, but when I have perfect_foresight_solver(lmmcp); I get the error that the variable is not recognized. Please advise.

For the endval-problem I would need to see the codes. Did you change the value of the exogenous processes for the last period after computing that steady state?

Yes, if you don’t use a correct solver, the tag will be ignored.

Regarding the model-local variable, could you please provide me with the code.

I have sent the code. I have a shocks block and the value of the exogenous process changes after period one. It is not a modeled process, just a change from one value to another.

Thank you for clarifying.

The model local variable which is not recognized is the one from the first error ie line 84. I presume that the others will also be unrecognized since they are referenced in the equation for the model local variable on line 84.

The problem is on the graph. Within the command window it shows the steady states matching with what I found in matlab’s fsolve. On the graph, the points don’t line up with the command line. Could it be because of the missing lmmcp in the perfect_foresight_solver?

I have updated the model timing to read K(t) = etc with K(t-1), instead of K(t+1) = etc with K

Thank you for letting me know re defined vs model-local variavles. What would be the best way to fix this? Thanks

Thank you again for your reply. This is what I saw for the graphs of c, K, L, and d. I tried defining a new endogenous variable (11 actually as they are auxiliary variables that need each other, and I think one long variable may cause debugging issues). My result went to imaginary numbers. Apologies, I am new to dynare. I have read the manual and checked out GitHub, but I am still running into some issues.