Hi Hecticmetric,
First remark, it is not a good idea to use such tricks if you want to solve a stochastic model with Dynare, because we only consider local approximations (first order or second order) around the deterministic steady state (pertutbation method) and can not handle this kind of nonlinearity. In this case a global approximation approach would be needed.
For deterministic models (solved by a relaxation method using the dynare command simul) this kind of nonlinearity can be handled, but the new Dynare macro language can not be used for this purpose. Suppose that the equation is:
- Code: Select all
z-g(x) = 0
if y>0, and
- Code: Select all
z-f(x) = 0
otherwise, where g() and f() are two continuous functions. This can be coded as follows in the model block :
- Code: Select all
(y>0)*(z-g(x)) + (1-(y>0))*(z-f(x)) = 0
or equivalently:
- Code: Select all
(y>0)*g(x) + (1-(y>0))*f(x) = z
The test function
> has been added recently in Dynare (and is still undocumented), so you need a recent version of Dynare v4. If a is greater than b, then (a>b) is equal to one otherwise (a>b) is equal to zero.
Best,
Stéphane.