Smooth approximation max function

Hello everyone,

i need to use the max()-function for my model. From this forum i learned that the max-function is only supported in a deterministic setup, so it is of little help for me. The obvious alternative is a smooth approximation to the max function, which has no kinks and therefore allows the model to be solved by standard pertubation methods. The one I used is the following (for max(0,variable) )

ABS= ( sqrt(VARIABLE^2) + VARIABLE) / 2 ;

The problem i am now encountering is that dynare somehow ignores the square on my VARIABLE^2. Even if i define a variable like
TEST = VARIABLE^2 , this variable becomes negative on the adjustment path.

Is there any reason for this?

The alternative would be to use the extended-path method, but i am not sure about this as i know little about it.

Many thanks!
Simon

Yes: at order 1, Dynare linearizes around the steady state, so the positivity constraint of your square function is not enforced. At second order, Dynare will use a 2nd-degree polynomial expressed in terms of state variables and exogenous shocks; if your VARIABLE is not a state variable, the polynomial will not necessarily be the one you entered, and the sign condition can therefore be violated.

Essentially it is not possible to emulate a max-like constraint with a pure perturbation method. You really need deterministic simulations or extended path.

Dear Mr. Villemot, many thanks for your answer!

One thing I do not undersand about it is why you said “deterministic simulations OR extended path”. Does the extended path method not provide a deterministic solution as well? As far as i understood this method, agents assume future shocks to be zero when computing their expectations.

Is this different if you run a simulation using extended path in dynare? This point is very important to me, as i want to conduct a welfare analysis.

many regards,
Simon

What I meant by “deterministic solver” was the “simul” command, which is a deterministic solver assuming perfect foresight. The extended path indeed uses a deterministic solver, but does not make the perfect foresight assumption.