Substitute for signum function


I am currently running an IRBC bond economy model and would like to dampen bond trade by taxing the return on bond with (1 + tau). As I want to discourage borrowing and lending, tau should be positive when the bond position is negative (as to increase the interest cost when in debt), but negative when the bond position is positive (so as to reduce the return on savings).

Simply defining tau = 0.01*(-1)sign(B), where B is the bond position, is not allowed in Dynare and trying something along the lines of tau = 0.01(-1)*abs(B)/B leads to problems with the derivative as the bond position is zero in steady state.

Do you happen to know of any way to resolve this? All comments are greatly appreciated!

Many thanks,

Both sign and max/min introduce non-differentiabilities that will not work with perturbation based methods. You would need to define something like a continuous barrier function. See e.g. … C_2010.pdf