I am trying to introduce a zero lower bound on the central bank’s policy rate in a New Keynesian DSGE model:

(…)
varexo_det
impose_ZLB;
(…)
model;
(…)
i = (1-impose_zlb)*(forward-looking Taylor rule with interest rate smoothing);
(…)
end;
(…)
var impose_ZLB;
periods 1:20 21:32;
values 1 0;
(…)
stoch_simul(periods=0,order=1);
forecast;

The code runs smoothly, but the simulated path of the policy rate is NOT zero for the first 20 periods as it should be.
Any ideas how this could happen?
Thanks.

It is impossible to simulate a ZLB model with stoch_simul (i.e. with a stochastic perturbation method). The constraint will not be enforced, as you noted. The reason is that the approximated policy function is either linear or polynomial around the steady state, but in any case it does not incorporate the constraint.

You should either use simul (perfect foresight) or extended path for correctly simulating ZLB models.

Thanks for your response. What do you think of setting up a sequence of monetary policy shocks (in a deterministic simulation) that counteracts the endogenous response of the policy rate, which would then look as if a zero lower bound existed?