# Occbin ZLB non-convergence and almost singularity

**URL:** <https://forum.dynare.org/t/occbin-zlb-non-convergence-and-almost-singularity/26004>\
**Category:** Occbin\
**Created:** [30 June 2024 15:34 UTC](https://forum.dynare.org/t/occbin-zlb-non-convergence-and-almost-singularity/26004 "2024-06-30T15:34:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scholzda](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@Scholzda](https://forum.dynare.org/u/Scholzda)\
**Post date:** [30 June 2024 15:34 UTC](https://forum.dynare.org/t/occbin-zlb-non-convergence-and-almost-singularity/26004/1 "2024-06-30T15:34:02Z")

</div>

Hello Friends,

Im trying to replicate Chapter 3.2 of Sims (2023) four equation new-keynesian model.

Here a ZLB binds in expectation 4 periods due to an adverse natural rate shock.

I have so far replicated most findings of the paper, my reference model is thus operational.

I do, however run into issues with my ZLB config. I get the following error of: "Operation terminated by user during occbin.mkdatap\_anticipated\_dyn (line 100)

In occbin.solve\_one\_constraint (line 190)  
[zdatalinear\_, SS\_out.T(:,:,shock\_period), SS\_out.R(:,:,shock\_period), SS\_out.C(:,shock\_period), SS, update\_flag]=occbin.mkdatap\_anticipated\_dyn(nperiods\_0,DM,…

In occbin.solver (line 84)  
[out, ss, error\_flag] = occbin.solve\_one\_constraint(M\_,dr,options\_.occbin.simul,solve\_dr);

In OptimalPolicyZLB.driver (line 475)  
[oo\_.dr, oo\_.occbin.simul]= occbin.solver(M\_, options\_, oo\_.dr , oo\_.steady\_state, oo\_.exo\_steady\_state, oo\_.exo\_det\_steady\_state);

In dynare (line 310)  
evalin(‘base’,[fname ‘.driver’]);"

I suspect, that I can’t use the linearised model for this or need to account for the nominal gross interest rate sticking to 1. Otherwise, maybe, I need to give ss - values for the model, which I have not since I encoded the model block as linear.

I would rly appreciate any help, thank you !

[OptimalPolicyZLB.mod](https://forum.dynare.org/uploads/short-url/uRW5q8l9pkdtSbMEGcZlvwDxsN4.mod) (8.3 KB)

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [1 July 2024 08:46 UTC](https://forum.dynare.org/t/occbin-zlb-non-convergence-and-almost-singularity/26004/2 "2024-07-01T08:46:46Z")

</div>

Please see

> [@Implementing ZLB in Ireland (2004)](https://forum.dynare.org/t/implementing-zlb-in-ireland-2004/20055/2):
>
> Your constraint is wrong. The ZLB does not bind when r=0 and therefore the interest rate is in steady state. Rather, it can fall by 1-1/beta. See also

---

<div class="post-metadata">

**Author:** ![Scholzda](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@Scholzda](https://forum.dynare.org/u/Scholzda)\
**Post date:** [2 July 2024 11:24 UTC](https://forum.dynare.org/t/occbin-zlb-non-convergence-and-almost-singularity/26004/3 "2024-07-02T11:24:13Z")

</div>

Thank you for this note Professor Pfeifer.

I have now included Gross Rates, which I assign SS-Values of unity (hence, the economy starts directly at the ZLB).

This results in convergence, yet I still receive the error message:  
“Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.393744e-22.”

The resulting graphs look, at first glance, satisfactory. Yet it results in unrealistically large gap and deflation values.

 ![image](https://forum.dynare.org/uploads/default/original/3X/1/8/18fbc08d37e791968ab4179529167601a9ea5b84.png)

The log deviation from ss of the gap would be negative 2\*10^8, which is basically a move back to Stone Age upon impact of a 100 bp natural rate shock.

Is there anything I can do to fix this?  
Or should I move to a deterministic simulation? If so, do you have a reference for a stochastic simulation at the ZLB that could translate to my model?

Thank you!

Best,  
David  
[OptimalPolicyZLB.mod](https://forum.dynare.org/uploads/short-url/mkWKycLJG8X2LEIGQcTStsLeUJ1.mod) (9.0 KB)

---

<div class="post-metadata">

**Author:** ![Scholzda](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@Scholzda](https://forum.dynare.org/u/Scholzda)\
**Post date:** [2 July 2024 17:10 UTC](https://forum.dynare.org/t/occbin-zlb-non-convergence-and-almost-singularity/26004/4 "2024-07-02T17:10:37Z")

</div>

I now believe, that the unusual large losses are due to my models inability of communicating the (expected) duration of the ZLB. Indeed, the IRF’s of r\_s (nominal rate) is never zero (even after 20 periods). Hence, x and pie are almost infinite expected discounted sums. @jpfeifer is there any way of communicating to the model, that the ZLB will be left after a certain time elapsed? For example is there a possibility in OccBin, in addition to the **existing** unexpected negative shock, to add an **expected** positive shock to the natural rate?  
Thank you !

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [5 July 2024 12:34 UTC](https://forum.dynare.org/t/occbin-zlb-non-convergence-and-almost-singularity/26004/5 "2024-07-05T12:34:25Z")

</div>

You need to check your setup. I would have expected something like this:  
[OptimalPolicyZLB.mod](https://forum.dynare.org/uploads/short-url/tvQfqyLdC8p1SuGvCWp3A1nnP3y.mod) (8.7 KB)

---

<div class="post-metadata">

**Author:** ![Scholzda](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/46a35a/32.png) [@Scholzda](https://forum.dynare.org/u/Scholzda)\
**Post date:** [5 July 2024 21:06 UTC](https://forum.dynare.org/t/occbin-zlb-non-convergence-and-almost-singularity/26004/6 "2024-07-05T21:06:58Z")

</div>

Thank you for your help professor ! The new constraint makes sense to me. Yet I believe, that I need to use a different implementation strategy of the ZLB for the replication, one where I can communicate expected duration of the ZLB and the adverse Shock more clearly. Ill likely make use of Eggertson et al.'s Toolkit which allows for stochastic ZLB’s. [ZLB\_Toolkit.pdf - Google&nbsp;Drive](https://drive.google.com/file/d/1zO1PMRHxFii2l3vsdSI23cvuu0NLDxX5/view)
