Occbin for a novice user.Is there a simple mod file?

But there must be a shock that sufficiently drives the leverage ratio.

The author argues that a sequence of realization of exogenous shocks can take the economy to a high leverage ratio state at which the constraint becomes binding.

I tried one shock at a time resulting in no piecewise linear solution.

What does that mean? It does not trigger the constraint? Or no result is displayed?

prints following error:
Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.

In occbin.mkdatap_anticipated_dyn (line 104)

and the IRFs look like the figure attached showing no piecewise solution
plot.fig (90.3 KB)

But this is again a sequence of shocks. Please try a one-time large shock to trigger the constraint.

As you suggested, I tried with one time large negative (-20%) shock to TFP
Plot_tfp.pdf (9.2 KB)
and one time large positive (20%) shock to world interest rate.
plot_int_rate.pdf (9.1 KB)
Neither of these shocks seemed trigger the constraint and printed the same error message.

As a side note, I assume that the collateral constraint is not binding in the reference regime and the first order conditions are derived without considering the constraint.

If you get the same error message, then you are triggering the constraint but OccBin fails. The big question is why. That’s why I suggested to run an experiment where the constraint becomes just binding.

  1. When I run it with one large shock using Occbin toolbox, I get the following figure with error “Increase nperiods”
    Plot_tfp_toolbox.pdf (7.9 KB).

  2. However, running it with small shocks at two periods (period 1, 21; 0.02, -0.02) at Occbin yields the following figure without printing any error.
    Plot_tfp_toolbox_2shocks.pdf (9.9 KB)
    However, the variables respond with two periods lag (23rd period).
    Would you kindly make any comment?

Can I share the mod file with you?

The second figure looks promising. In that case, the constraint is triggered, and OccBin finds a solution. That suggests that the model does indeed work. Now you need to understand what happens once you move closer to your desired experiment.

Thanks for your feedback.

  1. Changing the first shock period from 1 to 10 gives the following IRFS and prints “increase nperiod”. Incrasing nperiod does not help. I wonder what roles does the shocksequence (not the shock size) play in solving the model?

  2. My ultimate goal is to implement optimal simple rules (monetary and FX intervention) in the NK version of this model. To do so, I guess I need to use dynare-occbin Not the occbin toolbox. Am I right, professor? Is there any example file which does this type of exercise?

  1. Again, that is strange. The first shock period should not matter as they are surprise shocks.
  2. No, there is no example of this.
  1. I also wonder why Dynare OccBin fails to trigger the constraint and results in “NaN” piecewise linear solution. Any guidance would be of much help.

  2. I have written a mod file to implement the simple monetary policy rule. I have sent you it through message. I ain’t sure whether that’s the right approach or not. Could you please let me know your comments?

  1. I don’t know. You would probably need to debug with a simpler model.
  2. Your code won’t work as expected. OccBin results in a piece-wise linear solution and is certainty equivalent. Therefore, you cannot rely on oo_.dr.ghs2 to get a risk correction. Moreover, you should not be looping over the full mod-file.

Thank you!
2. Would you please give me a clue on which part of the mod file I should loop over?

That depends on what you are trying to do. But in OccBin you would usually just loop over occbin.solver.

@jpfeifer For a log-linearised model with about 33-40 equations and one OBC, how long should estimation with the PKF take?

My co-author and I have had the code running for about a week now – we think it is in mode finding stage of the estimation.

I don’t really have experience with that. Is there any output in the command window?

Yeah it’s the ‘I am now climbing the hill’ stage.

I see. mode_compute=6 already takes a lot of time without OccBin. So it is not surprising that it takes long.