Chapter 9. Numerical core and reproducibility
Reproducibility is an engineered property, not a synonym for “same seed.” A defensible pharmacometrics run must bind random streams to scientific work units, keep parallel scheduling out of statistical identity, expose matrix repairs, record numerical tolerances and define how much cross-platform variation is acceptable.
What you will learn
- how nlmx derives deterministic streams from a seed, label and derivation version;
- how pseudo-random, antithetic and quasi-random normal draws differ;
- how Cholesky, ridge stabilization, eigendecomposition and pseudoinverses are selected;
- which descriptive statistics, quantiles, intervals and distribution functions are shared;
- why thread count does not change stochastic identity, but does not guarantee speedup;
- how stages, logs, hashes and checkpoints preserve numerical context;
- how to specify tolerance-based validation across builds and platforms.
Prerequisites. Read Chapter 7 for settings and provenance and Chapter 8 for model solvers and derivatives.
Version scope and evidence
Behavior was checked against nlmx 4.4.0, primarily the random-number, linear-algebra, statistics, logging and hashing layers, command thread configuration and posterior checkpoints. Executable evidence uses the available 4.3.0 release and is labelled accordingly.
pytools/ch09_examples.py simulates 400 subjects in 16 subproblems with seed 90901 at 1, 2 and 4 threads. The two stable data products are byte-identical across thread counts. Timings are retained as an illustrative end-to-end measurement, not a hardware-independent benchmark.
Nineteen pages in this chapter
| Page | Topic |
|---|---|
| 9.1 | The reproducibility contract |
| 9.2 | Seed, label and stream derivation |
| 9.3 | Uniform, normal, integer and shuffle algorithms |
| 9.4 | Antithetic and quasi-random draws |
| 9.5 | RNG versioning, checkpoints and resume |
| 9.6 | Dense matrices and Cholesky paths |
| 9.7 | Ridge stabilization and pseudoinverses |
| 9.8 | Condition numbers and PSD repair |
| 9.9 | Descriptive statistics and type-7 quantiles |
| 9.10 | Distribution functions and confidence intervals |
| 9.11 | Parallel execution architecture |
| 9.12 | Thread-count determinism |
| 9.13 | Performance and scaling measurement |
| 9.14 | Logging, stages and verbosity |
| 9.15 | Hashes, checkpoints and numerical identity |
| 9.16 | Floating-point and platform differences |
| 9.17 | Tolerance-based numerical tests |
| 9.18 | Worked determinism and scaling experiment |
Continue with the reproducibility contract.