# Non negativity constraints in DETERMINISTIC setting

Hello to everyone!

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?

Thank you very much in advance.
Maksim

Using the `mcp`-tags. See e.g. https://github.com/JohannesPfeifer/DSGE_mod/blob/master/Gali_2015/Gali_2015_chapter_5_discretion_ZLB.mod

Dear Johannes,

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.

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

How would you implement it in Dynare?

Thank you very much in advance.
Maksim

1. You need to used the Dynare 4.5 version (at least)
2. If you use Dynare 4.5, the manual will have an entry on `lmmcp` that should provide the details.

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.

Thank you,
Bethel

Yes, it should be able to handle as many inequalities as equations.

Perfect! This is helpful. Thank you!

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_2
1/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.

1 Like

Thank you for clarifying. Is there a way to ensure that

is positive? For example, in stata and matlab I could use assert to ensure that the value is positive, otherwise it throws an error.

Again, what do you mean? The constraint stipulates the value must 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?

Again, if you setup the problem correctly, then the value cannot be negative, because this is the very definition of the constraint being binding!

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.

1. 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?
2. Yes, if you don’t use a correct solver, the tag will be ignored.
3. Regarding the model-local variable, could you please provide me with the code.

Thank you Professor Pfeifer for this response.

1. 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.
2. Thank you for clarifying.
3. 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.
1. Where can I see your problem? Because I only see that the initial steady state is different, not the terminal one.
2. Are you sure your model timing is correct? Shouldn’t capital be predetermined? Currently, consumption is the only state.
3. The `mcp`-tag only works on defined variables, not on model-local variables. That is the problem here.

Thanks for you reply Professor Pfeifer.

1. 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?
2. I have updated the model timing to read K(t) = etc with K(t-1), instead of K(t+1) = etc with K
3. Thank you for letting me know re defined vs model-local variavles. What would be the best way to fix this? Thanks
1. Again, for which graph exactly can I see this?
2. Simply define a new variable instead of a model-local variable

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.