Page 1 of 1

How to use dynare to express sign and abs function

PostPosted: Sat Jan 30, 2010 2:48 pm
by xujh03
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?
Thanks

Re: How to use dynare to express sign and abs function

PostPosted: Thu Feb 04, 2010 11:45 am
by SébastienVillemot
Hi

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.

Best

Re: How to use dynare to express sign and abs function

PostPosted: Sat Feb 20, 2010 10:18 am
by StephaneAdjemian
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:

Code: Select all
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.

Best,
Stéphane.