Documentation

12.12 Numerical safety and MU referencing: COD08 and COD11

COD08 searches for common numerical hazards around logarithms, square roots, and division. COD11 asks whether MU-referencing statements are present when an EM or Bayesian estimation method makes them relevant. These checks target failures that may appear only for a small subset of subjects or parameter proposals.

Numerical operations require defensible domains

Guard the mathematical domain

LOG(X) requires a positive X, SQRT(X) requires a nonnegative X, and A/B requires a denominator sufficiently far from zero. A check may accept a recognizable guard such as a lower bound or conditional branch, but the scientific choice of guard remains yours. Replacing every denominator with MAX(B, 1E-6) can keep arithmetic finite while materially changing the model near zero.

For novices, the safest workflow is to write down the expected units and possible range of every operand. Then test boundary records: zero dose, zero time, below-quantification observations, extreme covariates, and parameter values near permitted bounds. Numerical safety is not proved by a clean parser result.

MU referencing

MU referencing expresses typical parameters on a scale suited to expectation-maximization and Bayesian methods. COD11 is not a universal demand for MU statements; it becomes applicable when the selected method calls for them. A finding should trigger review of the parameterization and estimator documentation, not mechanical insertion of MU_n assignments.

The checker cannot establish that a guard is differentiable enough for the estimator, that a chosen floor is scientifically negligible, or that MU referencing is optimally parameterized. Compare objective values, gradients, estimates, and reproducibility under the target NONMEM version.

Common mistakes

  • Guarding a result after the invalid operation has already occurred.
  • Choosing a dimensionless floor for a quantity with physical units.
  • Hiding negative values with ABS without explaining why negatives occur.
  • Adding MU statements by pattern without mapping them to the right THETAs and ETAs.

Checklist

  • Enumerate every LOG, SQRT, and division operation.
  • Define scientifically plausible domains and boundary tests.
  • Confirm guards execute before risky arithmetic.
  • Review COD11 in the context of the selected estimator.
  • Stress-test the model in NONMEM, including difficult subjects.

Further reading

See estimation checks, validation boundaries, and numerical reproducibility.