My goal is to tune the ODE integrator such that we calculate the right precision. Any higher precision is a waste and any lower as well. Since the ODE integration numerical cost apparently dominates ODE Stan programs, this can give us better speed and I think it hasn’t been explored a lot yet.
I would like to use the step size and mass for a parameter in order to set the absolute tolerances for the sensitivities of the states. The cvodes user guide states that:
The selection of absolute tolerances for the sensitivity variables is based on
the observation that the sensitivity vector si will have units of [y]/[pi]. With this,
the absolute tolerance for the j-th component of the sensitivity vector si is set
to atol_j/|bar(p)i|, where atol_j are the absolute tolerances for the state variables and
bar(p) is a vector of scaling factors that are dimensionally consistent with the model
parameters p and give an indication of their order of magnitude.
I think this is worthwhile to explore (currently the bar§ is set to the default 1, no scaling). However, I realize that it is way to early to think about putting anything into Stan at this point I should experiment a bit. I was wondering if I wanted to embark on this in Stan, if I could.
This stuff has, of course, the usual chicken-egg problem just as warmup (the scalings can be set well once we have a good knowledge on them which you have after having integrated the system a few times).