mara
November 19, 2022, 10:54am
#1
Dear all,
I am quite new to Dynare. I would like to code up the following:

v_t = s_t-sbar-Omega if s_t > sbar+Omega. Otherwise (i.e. if s_t <= sbar+Omega) v_t should be zero.

What I tried in the Dynare model block is

v = max(0, (s-sbar-Omega));
and
v= (s>(sbar+Omega))*(s-sbar-Omega);
However both do not seem to do what I need. While the first suggestion yields also negative values for v_t, the second suggestion is always zero.

Could anybody help me on this issue? Many thanks in advance.

Are you doing stochastic simulations or perfect foresight?

mara
November 21, 2022, 4:20pm
#3
Currently I am trying stochastic simulation.

Thatâ€™s the problem with linearizations:

First, Dynare does not impose non-negativity constraints. How should it do that and know for which variables such a constraint applies?
Second, in a linearly approximated model, there are no bounds on the endogeneous variables as every policy rule is linear. Hence the curvature implied by the Inada conditions is always lost. Using higher order approximation may make the problem better but will not get rid of it (unless you go to order infinity)

mara
November 22, 2022, 8:00am
#5
So, did I get it correctly that what I would like to do does not work, at least no when doing stochastic simulation (what is with perfect foresight?)?

Would it then be possible to have something like
if x> some threshold, y=f(x) and otherwise if x< some threshold, y=g(x), with f(x) and g(x) being different?

It depends on the context. You could use a piecewise linear solution (OccBin) or perfect foresight simulation with mcp-tags.

mara
November 23, 2022, 7:40am
#7
Thank you so much for your help