Dear Dynare team,

I am trying to convert a mod file that works for 4.5 to 4.6. However, the following error comes out:

Using 64-bit preprocessor

Starting Dynare (version 4.6.4).

Calling Dynare with arguments: none

Starting preprocessing of the model file …

ERROR: Division by zero!

terminate called after throwing an instance of ‘DataTree::DivisionByZeroException’

The mod file have 1 var equal 0 which was discussed here https://git.dynare.org/Dynare/preprocessor/-/issues/66

I wonder if there is any way to go around this with 4.6 (as it works for 4.5). Thank you so much.

two_sector_vcu_binding.mod (4.8 KB)

Please upgrade to Dynare 5.1. The simplification in Dynare 4.6 is buggy.

Dear Prof Pfeifer,

Thank you. I test it with Dy 5.1, looks like the problem is unsolved. Do you have any other ideas to get around this? Thank you so much

Starting Dynare (version 5.1).

Calling Dynare with arguments: none

Starting preprocessing of the model file …

ERROR: Division by zero!

terminate called after throwing an instance of ‘DataTree::DivisionByZeroException’

I think if I set in= 0.0000001 instead of zero, the mod file can run with dy 5.1. The mod file is created to use with the Occbin by Guerrieri and Iacoviello for the paper “Social Distancing and Supply Disruptions in a Pandemic”. However, Dy 4.5 let it run with in =0 so I guess there are some changes on Dy 4.6 and 5.1.

In your opinion, does changing “in” to a very small number (instead of zero) can affect the result or not ? Because my project tries our best to keep the authors’ code as it is. Thank you so much for your help.

There must be something wrong here. In equation 2, you have a division by `in(-1)`

, which cannot be with `in=0`

in equation 17.

I believe this is an implementation of the irreversibility of capital which can be also found in http://www.lguerrieri.com/occbin.pdf. Instead of the Iss in the original Occbin paper, Iss should be zero in this case. For the mod file with a relaxed constraint, lambdai=0 in eq 17. I take a look at Occbin in Dy 5.1 example, in line 110, Mod file state that:“name ‘INEG’; bind log_Invest-log(steady_state(Invest))<-0.000001; %not exactly 0 for numerical reasons”. This gives me a hint to change in=0.00000001 instead of in=0. So I guess for Dy5.1, we need to do this to get around the error. If i set it to zero for Occbin_example, the algorithm is not working also. My last question is that if this can change any results? I get same results with in=0.00000001 for key variables but I cannot check everything.

Occbin_example.mod (4.3 KB)

I think I messed up a bit. Look like in the http://www.lguerrieri.com/social_distancing_and_suppl.pdf. They set phi=0 instead of 0.975 in http://www.lguerrieri.com/occbin.pdf. It does not relate to steady-state of investment. What surprised me is the mod file can be run with no problem in 4.5.

I would not call it

The file can be preprocessed, but as soon as you would try e.g. finding the steady state, you would run into the same problem. The new Dynare version simply added a check for this type of issue.

Thank you. I see your point, looks like the authors only need to extract the model information to proceed further with Occbin, that’s why the replication went well with Dy 4.5. I am not really an expert at using Occbin. Is there any comment to turn off a check at preprocessing?

What if I set phi = 1e-16, so I can mostly approximate the case of " the investment, once installed as

capital, is irreversible" and get around of the preprocessing of Dynare as it might only be a problem if it is exactly zero. Can I hear your thought about this?

I see that the Occbin algorithm inside Dynare needs to set the binding constraint condition to small number instead of zero also. Can you give me a hint why zero cause the problem in this case ? I might find it useful to apply on my problem

Really appreciate your help on this.

Sorry for keep bothering you, I mean using Occbin toolbox in https://github.com/JohannesPfeifer/Occbin_update. I see that you do not have any example for the irreversibility of capital in this folder.

I would stick to Dynare 5.1 for the implementation instead of the updated original Occbin. In Dynare, it should be similar to

1 Like

Thank you so much for your help, it seems like for a extreme case of in = phi*in_ss with phi=0, the implemented Occbin cannot help also. I will need to find the other way.