Documentation

Preface: why this book exists

The path from question to action

Pharmacometrics combines biology, clinical data, mathematical models, statistical estimation, numerical computation, simulation, and scientific judgement. Most costly mistakes occur at the boundaries between those things: a dose record interpreted differently by two tools, a residual-error scale changed during translation, a model that converges to another solution basin, a simulation that uses a different population than the fit, or a polished figure that conceals an important warning.

nlmx brings many of these activities into one text-first program. That integration can remove hand-offs and reduce runtime, but integration alone does not establish correctness. A user still needs to understand what question each method answers, what assumptions enter the calculation, which output proves that the intended calculation ran, and what evidence is required before using the result. This book exists to supply that connective explanation.

More than a command catalogue

The short guides under docs/ are deliberately compact. They are the right place to check syntax, see an option, or recall an output name while working. This book has a different job. It explains:

  • why a workflow is ordered as it is;
  • what a method estimates and what it does not estimate;
  • how data, model, and numerical choices interact;
  • how to interpret warnings, diagnostics, uncertainty, and failure;
  • how to compare results with NONMEM, PsN, PopED, Monolix, or another reference;
  • how to retain enough evidence for an independent reviewer to reconstruct the decision.

Think of the quick guide as a cockpit checklist and the book as the training manual. Both are necessary. A reader should use nlmx <command> --help and the matching guide for exact current syntax, then return here for rationale, interpretation, worked reasoning, and validation boundaries.

The accuracy-before-speed principle

The project aims to reproduce important aspects of established pharmacometrics software while increasing speed. A fair speed claim must hold the scientific task constant. Before timing two implementations, align at least:

  1. the analysis population and handling of excluded, missing, and censored records;
  2. event semantics, doses, infusions, additional doses, steady state, and compartment mapping;
  3. structural, variability, residual, and covariate model parameterization;
  4. the likelihood or objective, including approximations and constants;
  5. optimizer, solver, stochastic, and stopping settings to the extent they define the task;
  6. the output quantity and acceptance tolerance;
  7. the decision that the number supports.

Only then is runtime a meaningful secondary outcome. A faster answer to a different question is not a performance improvement. Chapter 40 develops this comparison discipline; the planned Chapter 42 will turn it into a formal validation workflow.

What “reproduce” means here

Reproduction has layers. Two tools may accept similar syntax but implement different semantics. They may compute the same likelihood with different numerical methods. They may report objectives that differ by a constant yet produce equivalent parameter estimates. They may produce slightly different estimates that lead to the same scientific decision. The book therefore separates:

  • syntactic compatibility—whether an input can be read;
  • semantic compatibility—whether events and model statements mean the same thing;
  • mathematical compatibility—whether the target quantity is defined identically;
  • numerical agreement—whether computed values agree within justified tolerances;
  • decision equivalence—whether the supported conclusion is the same.

These layers prevent both false alarms and false reassurance. Exact equality is not always the right criterion for stochastic estimates, while similar-looking figures are never proof that the same model ran.

How examples are written

Examples are designed as teaching records. A complete example should name the input, command, important settings, expected artifacts, interpretation, warnings to inspect, and a next action. Some examples are conceptual and are labelled as such. Some use synthetic data. Neither category is a substitute for qualification on the user's intended model class, dataset characteristics, platform, and decision context.

Command lines use placeholders such as <CONTROL_STREAM> when a reader must substitute a local value. Do not type angle brackets literally unless the text says to. Long commands may be split across lines for readability; use the continuation syntax of the actual shell, or place the command in a script.

The role of refusal and warning

In a scientific program, refusing ambiguity is a feature. A nonzero exit code, unsupported-record message, missing-input error, or overwrite refusal protects the evidence trail. A warning means that the command completed with information that may affect interpretation; it does not mean “safe to ignore.” This book treats errors, warnings, notes, manifests, and resolved settings as first-class outputs.

The same principle applies to limitations. When nlmx does not represent an intended feature, the scientifically honest response may be to use another qualified tool. Chapter 40 documents known comparison boundaries and qualified workarounds. Translation that changes a model is model development, not clerical conversion.

The book is for learning and review

A novice should be able to start with no nlmx experience, learn the vocabulary when it first appears, follow the guided tour, and understand what each output is for. An experienced pharmacometrician should be able to jump to a command or method chapter, inspect the complete option/settings index, and identify differences from established workflows. A statistician or reviewer should be able to trace claims to assumptions and artifacts. A developer should be able to locate the numerical and validation contracts that must remain stable when code changes.

No single path serves all of those readers. The next pages describe prerequisites and give role-specific routes through the book.

What this book does not promise

This book does not promise that:

  • every NONMEM, PsN, PopED, or Monolix feature has an nlmx equivalent;
  • matching a command name proves matching mathematics;
  • convergence proves model adequacy or identifiability;
  • an automated QC pass proves the dataset is clinically correct;
  • a successful validation fixture proves every future dataset and model;
  • a generated report replaces scientific and independent review;
  • the supplied validation evidence alone satisfies every organisation's GxP requirements.

It does promise to make boundaries visible, to favour reproducible evidence over hidden state, and to explain how to ask the next verification question.

See edition and licence, continue to audience and prerequisites, or go directly to the reading paths.