Dynare:k_order_perturbation: Caught Kord exception: NaN or Inf asserted in first order derivatives


I keep receiving the following error in my attached Dynare code.

There are 10 eigenvalue(s) larger than 1 in modulus
for 11 forward-looking variable(s)

The rank condition ISN’T verified!

dynare:k_order_perturbation: Caught Kord exception: NaN or Inf asserted in first order derivatives in FirstOrder::solve

In the previous related posts in the forum it was suggested to check the timing of all equations. To me it seems that there is no problem there! What other possible issues can bring up this error?

baseline_model.mod (7.9 KB)

much appreciated!

The timing related to bonds looks strange. Why is the government budget balance dependent on expected inflation?

thanks for your replay @jpfeifer!

I am mainly replicating Bianchi et al. 2019.

The government budget constraint is the same as theirs on page 6, in real terms. The government pays subsidy for bond issuance rather than equity, which bringing them into the real term creates expected inflation. I hope it is more clear now!


Sorry, but right now I don’t have access to the article.

Sure. Here is the government budget constraint!

and the paper if neede!

Thanks again!
JME2019- Growth, slowdowns, and recoveries.pdf (1.4 MB)

So B_{t+1} is also a predetermined variable and should be deflated with P_t. That explains the timing error.

That’s a good point @jpfeifer ! Thank you so much.
I have fixed it and updated all the related equations accordingly (attached .mod file). But still, I get the same error! Can it be something more than a timing issue?

I also attach a pdf containing the equilibrium equations in case you need to see them!

benchmark2.mod (7.9 KB)
equations.pdf (162.8 KB)

The timing of your SDF also seems problematic. See DSGE_mod/Basu_Bundick_2017.mod at master · JohannesPfeifer/DSGE_mod · GitHub for a correct version that preserved the expected value.

Thanks! I will check that code and compare them.