Integration tolerances and modification possibilities - Data2Dynamics/d2d GitHub Wiki

In the following, integrator tolerances, their effect and trade-off behaviour is outlined. Also, automatic calibration of tolerances to cover scalings in observation functions is described.

Integrations in the d2d-framework are performed via the CVODEs package. Therefore, relative and absolute tolerances, RTOL and ATOL, are set via ar.config.atol and ar.config.rtol. The default values for both are 1e-6. The integration steps are chosen in a way that the Newton iteration of the implicit backward differentiation formula within CVODEs satisfies the error tolerance given by:

RTOL * |x_i| + ATOL , with internal state x_i.

Changing tolerance values can help improve the speed or convergence of the optimiser by setting looser or tighter tolerances, respectively. Hence, there is a trade-off between fast integration and better chi2 estimates and sensitivities which can improve the optimisation. On the other hand, a tight tolerance (e.g. 1e-12) can lead to large integration times or even failures in the integration, since the tolerances can't be met with the lowest step size available. A typcial strategy is: the accuracy of numerical integration of the ODEs should be primarily controlled by reasonably setting the relative tolerance. Only in if some states are very close to zero, this might become too costly. In this case, absolute tolerance can/should take over. Absolute and relative error tolerance are connected via something like an "OR" statement (exact form is given by the equation above), i.e. it is sufficient if only one of the two is (almost) satisfied. Absolute error tolerances are application-specific and can be chosen rather small since relative tolerances take over if states are large enough.

The sensitivities of the ODE system, integrated simultaneous with the internal states, get the same relative tolerance whereas the absolute tolerance is set to ATOL/|p_i| for a sensitivity with parameter i.

The crucial values for the model optimisation, chi2 and its sensitivities, are computed on the observations given in the model. Thus, a high scaling factor in the observation function can lead to loose tolerances of the optimisation. To adjust these in order to reach a desired accuracy for the observations, the absolute tolerances can be scaled by 1/max( sum_i( sum_j( dy_i/dx_j ))) with observation i and internal state j.

In the d2d-framework, adjustment of ATOL can be set on for internal states with

ar.config.atolV = 1;

for internal states and

ar.config.atolV_sens = 1;

for sensitivities. The range of the rescaled tolerances are hereby bounded to [1.e-4, 1.e-12] to preserve a good integration feasibility.

Note that the tolerances only control the numerical error in a single integration step, i.e. between consecutive integration time points. The global error along a time course is usually much larger. A rough rule of thumb is to decrease the tolerances by a factor 1/100 to have a similar accuracy at the level of the whole time course.

Further details can be found in the documentation of SUNIDIALS CVODES.