# Max function not working?

Hi,
I have a question regarding the max(a,b) function, page 12 of the manual. I wanted to use this function in order to simulate an economy where the central bank is constrained by the zero lower bound. For some reason the max function has no effect at all. The path of the variables is exactly the same as in the absence of the ZLB, and in particular the interest rate becomes negative.
The simulation I used is stochastic and I set order=1. Could it be that the max function is only useful in the deterministic solver, because dynare tries to approximate the max function up to first order?

Here is the toy model which I have used to explore the max function:

[code]Var y pi i i_t;
varexo e_d;
parameters sigma phipi beta;

beta=0.995;
sigma=1;
phipi=1.5;

model;
y = y(+1)-1/sigma*(i-pi(+1))-e_d;
pi = betapi(+1)+0.3y;
i_t = phipi*pi;
i = max(-0.005,i_t);
end;

check;

shocks;
var e_d = 0.1^2;
end;

stoch_simul (order=1, irf=10);
[/code]

I distinguish between a nominal interest rate target i_t and the actual nominal interest rate, and write (all variables are as percentage point deviations from their steady state):

```i_t = phipi*pi; i = max(-0.005,i_t);```
where pi is the inflation rate, phipi is the Taylor rule coefficient on inflation and the steady state interest rate is 0.005.

Many thanks for your help.
Best,
Ansgar

Dear Ansgar, It is not possible to simulate a dsge including a ZLB constraint with a pertubation approach because the model is not differentiable everywhere (differentiability is a required assumption for the taylor approximation). With a first order approximation we approximate all the nonlinear functions by linear functions, so your results are expected and there is no bug with the max function here. You have to use the perfect foresight solver.

Best,
Stéphane.

Hi Stephane,
thank you very much for your quick response! I’ll do that then.
Best,
Ansgar