Ode solver with random time span

Dear users,

I would like to know if the integrate_ode solver can take random time span for ts variable. In particular, I am using the solver

y = integrate_ode_rk45(ode, y0, t0, ts, params, x_r, x_i, 1e-5, 1e-3, 5e2);

and would like to have the starting point of the time span ts to be random draws from a posterior/prior distribution. Is it possible to do this in stan?


Not yet, but I have filed a pr for this to make it possible… feel free to review that pr if you can oe looby for it… this would be a very convenient for a few applications.

Thanks @wds15.
Would you mind explaining what you meant by pr and oe and looby? I do not understand these and where do i look for to review the pr? Sorry I am learning Stan and all these terms are not familiar to me at present.


Oh…sorry for the slamg.
Oe = or
Pr = pull request on github
Looby = make other people review the pr

Unless you are very versed in c++, then just ignore this. As you are just getting started with things All of this is a bit too advanced… so in short, your wish for the time vector being parameters is being worked on.

Thanks @wds15.

So do you recommend to move my code to github, so that others can review it? I havn’t used github for coding yet.


The Stan development happens on github. So if you want to participate in that, then you are most welcome do to so.

If you are asking for help on specific models, we can just use this fourm.


Thanks @wds15.

Another question. Is it possible for STANs ODE solver to produce nonnegative solutions? I know Matlab has this facility.

I work with an ODE model and use the likelihood as

  y_hat ~ lognormal(log(y[,5]), std);   

Where y[ ] is solutions to an ODE. In order for the above likelihood to work, the y[, 5] must be nonnegative.
So far, reading through STans documentation, I cannot see how this is possible. There may be a way to do this and I may have missed finding how to do this.

Without nonnegativety of y, my code is throwing an error: about the location parameter of the likelihood being NaN.
Any help is appreciated.