# OccBin with collateral constraint applies to intertemporal debt

**URL:** <https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511>\
**Category:** Replication Attempts\
**Created:** [26 April 2025 19:32 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511 "2025-04-26T19:32:15Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Victory10](https://forum.dynare.org/letter_avatar_proxy/v4/letter/v/8dc957/32.png) [@Victory10](https://forum.dynare.org/u/Victory10)\
**Post date:** [26 April 2025 19:32 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/1 "2025-04-26T19:32:16Z")

</div>

Hello!  
I have a question regarding the paper (Sims, 2021) [https://sites.nd.edu/esims/files/2023/05/financial\_constraint\_2017.pdf](https://sites.nd.edu/esims/files/2023/05/financial_constraint_2017.pdf), specifically about the case when a collateral constraint applies to intertemporal debt.  
I am struggling to understand how to solve this model using OccBin, because the activation of the borrowing constraint depends on a stochastic borrowing limit.  
In particular:

1. When \xi \< \delta , we have \mu \> 0, and the borrowing constraint becomes binding.
2. When \xi \> \delta , then \mu \< 0 , and the constraint becomes non-binding.  
The difficulty is that the activation of the constraint depends on the value of \xi , which is an **exogenous parameter** that we specify manually in the code.  
Thus, I am not sure how to properly implement this condition in OccBin, since constraint activation is not purely endogenous to the model’s state variables but depends directly on \xi .

---

<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:** [29 April 2025 12:25 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/2 "2025-04-29T12:25:08Z")

</div>

I am not sure I understand the point. \xi\_t is an exogenous variable that follows an AR-process in that PDF. Of course it can enter the borrowing constraint like any other variable.

---

<div class="post-metadata">

**Author:** ![Victory10](https://forum.dynare.org/letter_avatar_proxy/v4/letter/v/8dc957/32.png) [@Victory10](https://forum.dynare.org/u/Victory10)\
**Post date:** [29 April 2025 12:47 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/3 "2025-04-29T12:47:10Z")

</div>

Professor @jpfeifer, I’m having trouble formulating the correct condition for OccBin in this context. What I mean is that, in solving this system, the steady state is determined through the expression μ = δ/ξ − 1. If I impose a constraint like min(mup, exp(k) \* u\_constr \* q\_K - exp(I)) = 0, then for ξ \> δ, we get μ \< 0. In that case, the steady state cannot be found, because the minimum becomes negative rather than positive.

---

<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:** [29 April 2025 12:56 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/5 "2025-04-29T12:56:25Z")

</div>

I don’t follow. What is the baseline regime, i.e., where is the steady state? When the constraint is binding or not binding. That will determine how you need to implement it in OccBin. The baseline regime must be the one with the steady state.

---

<div class="post-metadata">

**Author:** ![Victory10](https://forum.dynare.org/letter_avatar_proxy/v4/letter/v/8dc957/32.png) [@Victory10](https://forum.dynare.org/u/Victory10)\
**Post date:** [29 April 2025 13:05 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/6 "2025-04-29T13:05:48Z")

</div>

In this context, when ξ \< δ, the constraint becomes binding, and the system can be solved. I was trying to implement the solution similarly to the standard OccBin example, where we solve for b = M \* y (e.g., with M = 2). In that setup, we can specify a constraint like:

```auto
[name='constraint', relax='borrcon']
b = M * y;

[name='constraint', bind='borrcon']
llambda_b = 0;

occbin_constraints;
name 'borrcon'; bind llambda_b < 0; relax b > M * y; end;

```

Or, in the perfect foresight setup, it would look like:

```auto
min(llambda_b, 2 * y - b) = 0;

```

Is it possible to implement the borrowing constraint in this model using OccBin in a way similar to the standard OccBin example?

I want to implement it this way because I’m interested in seeing whether the constraint becomes binding or not in response to an unexpected shock. However, it seems that by setting the value of ξ exogenously from the start, we are effectively pre-determining whether the constraint will be binding or not.

---

<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:** [29 April 2025 13:35 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/7 "2025-04-29T13:35:51Z")

</div>

1. Yes, you should be able to follow that setup. Sims has a framework where the binding constraint is the baseline regime. Shocks might temporarily relax the constraint.
2. No, you could just keep \xi\_t unshocked at its steady state value. The endogenous response of the other variables in  
 ![image](https://forum.dynare.org/uploads/default/optimized/3X/d/a/dacd0038517bfbd6100596ba807306a9003ba186_2_690x55.png)  
like q\_t would determine whether the constraint becomes slack.

---

<div class="post-metadata">

**Author:** ![Victory10](https://forum.dynare.org/letter_avatar_proxy/v4/letter/v/8dc957/32.png) [@Victory10](https://forum.dynare.org/u/Victory10)\
**Post date:** [6 May 2025 18:01 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/8 "2025-05-06T18:01:31Z")

</div>

Professor @jpfeifer, thank you very much! I now understand how to proceed, but I have a question:  
How should the OccBin constraint be specified when the model’s main code and the steady state computation are located in separate files?  
I haven’t been able to figure out how to correctly include a block like:

```mod
occbin_constraints;
  name 'borrcon';
  bind mup < 0;
  relax b_1 > 2*y_1;
end;

```

When I insert this type of constraint directly into the `.mod` file, I get the following error: Unrecognized function or variable ‘occbin\_borrcon\_bind’.

---

<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:** [7 May 2025 06:50 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/9 "2025-05-07T06:50:07Z")

</div>

I would need to see the files.

---

<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:** [7 May 2025 08:44 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/11 "2025-05-07T08:44:56Z")

</div>

But where is the steady state file?

---

<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:** [7 May 2025 11:59 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/13 "2025-05-07T11:59:35Z")

</div>

Now the `param_core.m` is missing.

---

<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:** [7 May 2025 12:25 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/15 "2025-05-07T12:25:28Z")

</div>

At the beginning of the steady state file, you need

```auto
%initialize constraint parameter for passing through
occbin_borrcon_bind=M_.params(strcmp('occbin_borrcon_bind',M_.param_names));

```

[main\_steadystate.m](https://forum.dynare.org/uploads/short-url/ggUaVC1hkE8AW1XnetCSwi63aSM.m) (3.0 KB)

---

<div class="post-metadata">

**Author:** ![Victory10](https://forum.dynare.org/letter_avatar_proxy/v4/letter/v/8dc957/32.png) [@Victory10](https://forum.dynare.org/u/Victory10)\
**Post date:** [7 May 2025 12:33 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/16 "2025-05-07T12:33:32Z")

</div>

Professor, thank you very much for your help! May I ask one more question?  
I just want to clarify whether I’m setting this constraint correctly, as the resulting graphs seem odd – they show no dynamics at all. Moreover, the trajectories for both the piecewise linear and linear cases are identical, regardless of the size of the shock I apply.

 ![Снимок экрана 2025-05-07 в 15.33.04](https://forum.dynare.org/uploads/default/original/3X/4/7/47486da18a8ec4dccabb253a41feab47c23bd9c6.png)

---

<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:** [7 May 2025 12:38 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/17 "2025-05-07T12:38:53Z")

</div>

Run

```auto
occbin_graph y R loan z_cb pi;

```

to see that for some reason only `pi` moves. That is indeed unusual.

---

<div class="post-metadata">

**Author:** ![Victory10](https://forum.dynare.org/letter_avatar_proxy/v4/letter/v/8dc957/32.png) [@Victory10](https://forum.dynare.org/u/Victory10)\
**Post date:** [7 May 2025 12:44 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/18 "2025-05-07T12:44:39Z")

</div>

When I apply a larger shock, the variables do show dynamics, but the piecewise linear and linear trajectories still coincide.

---

<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:** [7 May 2025 12:50 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/19 "2025-05-07T12:50:45Z")

</div>

That usually indicates that the constraint does not become binding.

---

<div class="post-metadata">

**Author:** ![Victory10](https://forum.dynare.org/letter_avatar_proxy/v4/letter/v/8dc957/32.png) [@Victory10](https://forum.dynare.org/u/Victory10)\
**Post date:** [7 May 2025 13:03 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/20 "2025-05-07T13:03:10Z")

</div>

I suspect this issue arises because my capital accumulation equation is specified at time t, which means the constraint should involve k(-1). However, OCCBIN does not support lagged variables. When I rewrite the capital accumulation equation in terms of t+1, I encounter a Blanchard-Kahn error.

---

<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:** [7 May 2025 13:04 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/21 "2025-05-07T13:04:36Z")

</div>

You can always define `k_lag=k(-1)` and use `k_lag` in the constraint.

---

<div class="post-metadata">

**Author:** ![Victory10](https://forum.dynare.org/letter_avatar_proxy/v4/letter/v/8dc957/32.png) [@Victory10](https://forum.dynare.org/u/Victory10)\
**Post date:** [7 May 2025 13:12 UTC](https://forum.dynare.org/t/occbin-with-collateral-constraint-applies-to-intertemporal-debt/27511/22 "2025-05-07T13:12:42Z")

</div>

Thank you, Professor, for your help! I’ll continue investigating to figure out what’s going wrong.
