OccBin for different regimes

Hi everyone,

I’m working with OccBin to implement a simple experiment in which a parameter switches values depending on whether a given variable crosses a threshold. Concretely, I allow the parameter governing investment adjustment costs to take on a higher value when investment falls below its steady-state level, and a lower value when it rises above.

Key features of the setup:

  • Steady state: Since adjustment costs vanish in steady state, the occasionally binding constraint should not affect the steady state itself. That is, both regimes share the same steady-state solution.
  • Dynamics: One potential complication—possibly relevant to OccBin’s limitations—is that investment affects a highly persistent state variable (capital). However, changing the depreciation rate (delta) does not appear to alleviate the issue.

I’m attaching my final code (RBC_OccBin_2.mod), which implements the above mechanism using OccBin.

What is working:

  • The code runs for both positive and negative shocks of size 1. To switch between the two cases, you can simply change line 117 from “values 1;” to “values -1;”.
  • As expected, when the shock is positive, the piecewise linear solution coincides with the linear one. When the shock is negative, the piecewise solution shows a smaller drop in investment relative to the linear case, consistent with higher adjustment costs dampening investment responses.

What is not working:

  • Sensitivity to shock magnitude: The model runs for “values -10;”, but fails for “values 10;”, returning the error:
    “Occbin: Simulation did not converge – infinite loop of guess regimes.”
  • Sensitivity to constraint tolerance: Tightening the constraint threshold (e.g., from “.995” to “.999” in name ‘state’; bind i < steady_state(i).995; relax i >= steady_state(i).995;)
    causes the model to break even for a positive shock, with the same error message as above.
  • Failure with stochastic simulations: If I uncomment lines 102–112 (for simulations) and comment out lines 114–122 (for impulse responses), the code fails with:
    “Occbin: Simulation terminated with periodic solution (no convergence).”
    This failure only arises when the shock series is large enough to occasionally activate the constraint. If the shock series is small enough that the constraint never binds, the code runs without error.

I find OccBin extremely helpful for macro modeling with regime-switching features, and I’m trying to deepen my understanding of its logic to avoid these pitfalls and extend its use to more complex settings.

Any insights on how to improve convergence in cases like this; whether threshold-type constraints with persistent state variables are fundamentally challenging for OccBin; or alternative modeling strategies to implement such logic robustly would be greatly appreciated.

Best regards,
Marco

RBC_OccBin_2.mod (2.9 KB)

I don’t really know what to give you as advice. Inspecting the model run, the problem in most of the instances you report is that the constraint becomes binding at about period 40. OccBin then tries to find a regime combination that solves the model, but oscillates between guesses. That is, given the regime guess 1, the implied regime combination is guess 2. But conditional on guess 2, the implied regime combination is guess 1. That way, no solution is found. Maybe @rattoma has good advice.

1 Like

Many thanks for your response—it makes perfect sense. At this stage, I’m still considering the best approach for these types of models that should be relatively easy to solve while being handy for macroeconomic research. Hopefully, @rattoma can provide some valuable insights. Thanks again!

Hi there
sorry for the late reply. the main issue I see here is the (At the limit) you want to setup a contraint that binds at the steady state value. this is not an occasionally binding constraint. since it will bind in current period ~50% of the time and in expectation even more.

especially in the presence of persistent state variables like capital, duration of binding regime may be too long, or never ending (assume that the system converges to steady state ‘from below’, then the system will remain in the binding regine forever).

hence you should set a non negligible tolerance away from steady state to get robust simulations that work for different shock sizes. in any case, given the tolerance, there will surely be a shock large enough to impede convergence. So my advice is to pick the largest shock you have in mind, and make tolerance looser so that the simulation converges. all other simulations should converge as well.

1 Like

Many thanks for the clarification. It makes total sense, expecially the idea that if you are converging toward the steady state from below, then the constraint will be always expected to bind. I’ll try to implement the suggested solution and keep the community posted. Best, Marco