Page 1 of 1

max( ) fails in the stochastic environment?

PostPosted: Sat Feb 14, 2015 10:59 pm
by superztt
I defined a variable in dynare, as x= max(1, y) since this variable cannot be beyond 1, say a probability.

Unfortunately, dynare returned me with such a warning,
"WARNING: you are using a function (max, min, abs, sign) or an operator (<, >, <=, >=, ==, !=) which is unsuitable for a stochastic context; see the reference manual, section about "Expressions", for more details. ".

I didn't find the solution in the reference manual. My question is how to limit the domain of a variable in dynare in a stochastic context?

Re: max( ) fails in the stochastic environment?

PostPosted: Sun Feb 15, 2015 2:21 pm
by jpfeifer
In the stochastic context (except for extended path), the model must be differentiable. max operators introduce non-differentiabilities and will (mostly) be ignored. You can try to limit domains using transformations like:
for parameters with support [LB Inf): LB+exp(x) (inverse transformation of log(x-LB))
for parameters with support [LB UB]: (UB+exp(x)*LB)./(1+exp(x)) (inverse tranformation of log((UB-x)./(x-LB)))

However, a first order approximation will always approximate this linearly, i.e. in an unbounded way.

Re: max( ) fails in the stochastic environment?

PostPosted: Sun Feb 15, 2015 6:21 pm
by superztt
Thank you.

It is the IRFs that bother me. I can see that both the transformation and max ( ) work at the steady state, but fail at the IRFs. The response moved over the boundaries.

Just to clarify, does it fail only for first order approximation or for higher orders as well? Actually, I used 2nd order approximation.

Re: max( ) fails in the stochastic environment?

PostPosted: Mon Feb 16, 2015 12:16 pm
by jpfeifer
Kinks cannot be smoothly approximated at all.
Any boundary will be violated with some probability for derivative-based approximations. There is no way to avoid this, even for nth-order approximations.