Treatment of sign() in dynare
Posted: Thu Apr 04, 2013 6:29 pm
Hi There,
The dynare manual suggests that the signuum function is supported internally for both MODEL_EXPRESSION and EXPRESSION.
I tried a simple example in which a model variable was set equal to sign() of a normal shock. Since the shock in SS = 0 therefore the variable has a SS value of zero but should equal -1 or 1 in simulation (or more precisely, should equal -1 or 1 if we used the exact function, though perhaps not necessarily some approximation to it). Inspecting the simulated path @ 1st and 2nd orders of approximation (the model crashes at third, presumably because the dynare++ binaries do not support sign()) revealed that the variable was constantly equal to 0, leading me to wonder how sign() is processed by dynare... (i.e. is the constancy due to some assumptions about the non-existant derivative of sign() in zero, is a generalised notion of derivative used, perhaps? or should signum simply not be used in stochastic models?)
If the former, then I guess more broadly, the question would be how dynare deals with derivatives of non-differentiable (in this case even discontinuous) functions (max and min would be further examples)?
Any info on top of what is in the manual would be much appreciated!
Thanks in advance and apologies if this has already been covered somewhere!
pawel
The dynare manual suggests that the signuum function is supported internally for both MODEL_EXPRESSION and EXPRESSION.
I tried a simple example in which a model variable was set equal to sign() of a normal shock. Since the shock in SS = 0 therefore the variable has a SS value of zero but should equal -1 or 1 in simulation (or more precisely, should equal -1 or 1 if we used the exact function, though perhaps not necessarily some approximation to it). Inspecting the simulated path @ 1st and 2nd orders of approximation (the model crashes at third, presumably because the dynare++ binaries do not support sign()) revealed that the variable was constantly equal to 0, leading me to wonder how sign() is processed by dynare... (i.e. is the constancy due to some assumptions about the non-existant derivative of sign() in zero, is a generalised notion of derivative used, perhaps? or should signum simply not be used in stochastic models?)
If the former, then I guess more broadly, the question would be how dynare deals with derivatives of non-differentiable (in this case even discontinuous) functions (max and min would be further examples)?
Any info on top of what is in the manual would be much appreciated!
Thanks in advance and apologies if this has already been covered somewhere!
pawel