Error in integrate_ode_bdf, CVode error flag -1

Hi all,

I am trying to debug my model which is supposed to model some epidemiological behavior. I use the function integrate_ode_bdf, however during warm-up i get the following error (for the line where the integrate_ode_bdf is:
The current Metropolis proposal is about to be rejected because of the following issue:
Chain 1: Exception: CVode failed with error flag -1.

I have not really found much about when this error occurs or what causes it.

As soon as sampling starts, it starts to give the following error (once every 80 iterations or so):
Chain 1: Exception: neg_binomial_2_rng: Location parameter is 0, but must be > 0! which is a generated quantity calculated by the integrator

Does anyone know what this CVode message can be caused by?

Best, J

I wish we had ported those error flags into Stan message before pursuing anything further in ode features. Flag -1 indicates solver reaches maximum time step limit before finding an accurate solution. You can:

  • increase max num step of ODE solver, see manual.
  • investigate the nature of the system to see if the ODE model is setup correctly.

What Stan version do you use? I think we improved these error messages a lot recently when we introduced the variadic ode interface. So maybe switch to the latest 2.25.0 and use ode_bdf_tol instead if that is an option.


+1 to this. Reminds me when I first saw this TOO_MUCH_WORK check in Math I was wondering why just pick this error out of that many flags. Does it have particular ramification on Stan variadic interface?

There is no ramification here beyond en extra if statement in the code. You should actually also get the nicer error messages with the integreate_* calls as these just route their work through the variadic interface.

Stan 2.21ā€¦ but am not an expert in stan, i am a biology-person running the model on some clusters, where stan is pre-installed. So Iā€™d like not to change that too much.

Thanks to both of you anyway, i think a qualitative interpretation helps me already where to look.

What i completely forgot to say: this error pops up in the prior predictive check already, without running any inference