Documentation

20.33 A defensible NONMEM-to-nlmx reproduction workflow

Reproduction should be staged so that every discrepancy has a small search space. Begin by freezing the reference package: exact control stream, data bytes, NONMEM version, compiler/platform information, command, seeds, output tables, EXT/PHI/COV/COR files and listing. Record any wrapper behavior such as PsN preprocessing. A control stream alone is not a complete reference.

Translate without improving the model. Preserve $INPUT position, IGNORE/ACCEPT logic, event records, compartment numbering, parameterization, bounds, FIX/SAME/BLOCK declarations, residual-error scale and estimation settings. Confirm how missing values, BLQ records, predose observations, resets, lag times, bioavailability, infusion rates and steady state are handled. An apparently harmless cleanup can change the estimand.

Use a layered comparison:

  1. Input layer: identical included subjects, observations and event sequences.
  2. Prediction layer: evaluate both implementations at the same fixed parameter vector; compare PRED/IPRED and likelihood contribution record by record.
  3. Individual layer: compare ETAs and conditional objectives under matching approximation settings.
  4. Population layer: compare optimized estimates, OFV, gradients and termination.
  5. Uncertainty layer: compare covariance method, SEs, correlations, condition diagnostics and shrinkage.
  6. Presentation layer: compare tables and plots only after numerical layers agree.
A staged validation workflow for reference-software reproduction

Define tolerances before seeing results. Use absolute tolerances near zero and relative tolerances for larger quantities; add domain-specific thresholds for predictions and OFV. Exact text equality is usually inappropriate across implementations, while “looks close” is too weak. Report maximum and percentile discrepancies, records exceeding tolerance, and whether differences could change a scientific conclusion.

When disagreement appears, reduce the case: one subject, one dose, selected times, fixed ETAs, no residual randomness, then reintroduce complexity. Analytic ADVAN models can be compared with hand calculations; ODE models can be checked across solver tolerances. Use --max-iterations 0 with imported final estimates to separate evaluation differences from optimizer paths.

Speed comparisons must use equivalent workloads and warmed, repeated measurements. Separate parsing, optimization, covariance and plotting time. A faster result is valuable only when numerical and scientific acceptance criteria remain satisfied.

Common mistakes

  • Comparing only rounded final estimates.
  • Allowing different records into the objectives.
  • Mixing optimizer-path differences with likelihood differences.
  • Benchmarking one cold run or omitting covariance from one side.
  • Declaring equivalence without prespecified tolerances.

Checklist

  • Archive the complete reference environment and outputs.
  • Match records, likelihood and parameterization first.
  • Compare fixed-vector predictions before optimization.
  • Predefine tolerances and produce discrepancy tables.
  • Benchmark equivalent stages and preserve provenance.

Further reading

Read evaluate-only runs, input resolution, and validation and limits.