How to use dynare to express sign and abs function

Hi, I have a model which uses sign and abs function. But when I put it into the dynare, it seems that dynare cannot recognize it. Does anyone know how to solve this problem?


Currently the abs() and sign() function are not available in Dynare models. We may add them in the future if requested.

Note that their use only makes sense in a deterministic context; in a stochastic context, since we are approximating around a point, we are either on one side or on the other side of the abs() function, but we won’t cross the zero-point, because we are doing local approximation.


As sébastien says such functions are meaningless with a perturbation approach. However if you want to solve a perfect foresight model (deterministic) you can emulate the sign function as follows:

signX = (X>=0) - (X<0) ; 

where signX and X are declared endogenous variables. Obviously you can also emulate the abs function using the same trick.

Attached is an example with the ramsey model and a sign function on the variations of consumption.

ramst2.mod (501 Bytes)