(ODE solver) time variable for integrate_ode_bdf goes beoynd the limits

Hello all,

I have noticed that the time in integrate_ode_bdf(dz_dt, z0, 0, ts, theta, x_r, x_i); may go beoynd the limits. For example, if ts=1:52, then time within integrate_ode_bdf could be like 54-something. I assume it could be expected, but it makes also a bit difficult to integrate then the time-varied covariates. For example, if x_r gives a covariate over the time period (0,52), then it may become a bit surprising that integrate_ode_bdf goes to times beyond that.

Am I correct that the main recommendation would be to use integrate_ode_rk45 in this case?

Thank you in advance

Interesting find - but it does make sense, since the cvodes integrator does make a continuous approximation to the integrated function.

It’s a bit odd that the time-varying covariate abruptly stops at 52 in your example. Is there no obvious way to continue the covariate in a sensible way?

The rk45 integrator should stop at the final time-point, yes (but better try).

Thank you for your response!

Yes, it is possible to collect more data, but it’s a bit inconvenient. For example, I have a dynamic model over the period of 52 weeks (=one year), and my covariate is the temperature at different locations. Then I need additionally to gather observations for the latter say for 4 more weeks.

Another way would be just to put an if-statement in the model (if time>52: adopt the last value of the covariate). I did that and it worked, but I thought it was not so elegant.