Documentation

1.2 What is inside: the command map

nlmx has 22 commands. Every one is started the same way, nlmx <command> [input] [options], and every one writes its results to an output folder of its own (Section 4.2). This section puts all of them on one map: first the workflow they serve, then a table of what each reads and writes, and where this book explains it.

1.2.1 The workflow, from raw data to a reported model

A population analysis moves through seven stages. Figure 1.2.1 names the stages and the commands that do the work in each. The stages are a guide, not a rule: you can enter anywhere (a fitted model from NONMEM can go straight to vpc or forest), and you can loop (a failed check sends you back to the data).

Seven stages from raw data to a reported model, with the commands of each stage; Maxson spans all of them
Figure 1.2.1. The pharmacometrics workflow and where each nlmx command sits.
  1. Check. qc-data answers 99 questions about the dataset (is it readable by NM-TRAN, are the event records consistent, are the times in order, are there covariate outliers). qc-nm answers 81 about the control stream and writes a corrected copy; the original is never changed.
  2. Explore. eda draws the standard exploratory plots and tables; nca computes the non-compartmental parameters of every profile.
  3. Build. autoinit derives starting values from the dataset alone; screen fits one-, two- and three-compartment models (and optionally models with target-mediated drug disposition) and recommends a base model; fit estimates a control stream by FO, FOCE, FOCE-I, Laplace or SAEM.
  4. Covariates. cov tests candidate covariate effects without a NONMEM run per candidate, by a frozen-model engine and a posterior-stability engine; forest draws the effects with their uncertainty. posterior, inspect, validate and resume support this stage.
  5. Evaluate. vpc runs visual and numerical predictive checks (VPC, pcVPC, pvcVPC, NPC); fit --plots writes the goodness-of-fit figures.
  6. Simulate and plan. sims simulates a study and its exposure metrics; generate and simulate-study write synthetic projects and measure the operating characteristics of the methods; power estimates sample size and power by stochastic simulation and estimation, or from the Fisher information.
  7. Exposure-response. er relates exposure metrics to continuous, binary, ordinal, count and time-to-event endpoints.

Maxson, the assistant (ask), sits across all the stages. It turns a request in plain words into a checked sequence of the commands above, runs them after you say yes, and keeps an audit trail (Chapters 34 and 35).

1.2.2 The commands in one table

Table 1.2.1 lists every command with what it takes in, what it leaves behind and the chapters that explain it. "Run files" means the NONMEM-format results of a fit: .ext, .cov, .cor, .phi and, when present, .coi. The output names are those of the demonstration project of Chapter 3.

Table 1.2.1. The command map: command, purpose, main inputs, main outputs and chapters.

Command Purpose Main inputs Main outputs Chapters
qc-data 99 quality checks of a NONMEM-style dataset dataset (CSV) qc_checklist.csv, qc_findings.csv, qc_nonmem.txt (a suggested $INPUT and $DATA), figures, report.html 11
qc-nm 81 quality checks of a control stream, and a corrected copy control stream, dataset qc_nm_checklist.csv, qc_nm_findings.csv, <stem>_qc.ctl and a diff when something is corrected, report.html 12
eda exploratory plots and tables dataset 19 to 24 plots, up to 10 tables as CSV, report.html 13
nca non-compartmental analysis dataset, optional .nca settings nca_parameters.csv, nca_summary.csv, nca_lambda_z.csv, figures, report.html 14, 15
autoinit initial estimates from the data alone dataset initial_estimates.csv, init_blocks.txt (ready-to-paste NONMEM blocks), report.html 16
screen structural-model screen: 1 to 3 compartments, optional TMDD and transit absorption dataset best_model.ctl, model_comparison.csv, lrt_tests.csv, one folder per fitted model 17
fit estimate a control stream (FO, FOCE, FOCE-I, Laplace, SAEM) control stream, dataset .ext, .cov, .cor, .coi, .phi, final control stream, parameters.csv, predictions.csv, fit_summary.txt, report.html, plots/ 18 to 21
cov covariate selection by the frozen engine, the posterior engine or both control stream, run files, dataset, .covar settings draft_model.ctl, equations.csv, candidate_results.csv, report.html 22 to 25
posterior subject posteriors and shrinkage only control stream, run files, dataset posterior_summary.csv, shrinkage_summary.csv 24, 25
resume continue an interrupted cov run the output folder of that run the completed outputs of the run 25
inspect parse the inputs and list the candidate covariate scope; fits nothing control stream, run files, dataset, .covar a listing on the console 5, 25
validate inspect plus reconciliation of the files, a check of the objective function value and of feasibility the same as inspect a listing on the console 5, 25
forest forest plot of covariate effects and exposure fitted control stream, .ext, .cov forest.png, forest_results.csv, forest_report.html, SVG 26
vpc visual and numerical predictive checks control stream, estimates, dataset, optional .vpc settings plots/, npc_results.csv, vpc_bins.csv, vpc_report.html 27
sims simulate a study and its steady-state exposure control stream, optional dataset, optional .sims settings <stem>_data.csv, <stem>_sim.csv, <stem>_metrics.csv, <stem>_summary.csv, plots/, sims_report.html 28
generate (alias example) write a synthetic NONMEM project of a design you choose design options or a .gen settings file a project folder: data/, models/, settings files 3, 29
simulate-study operating characteristics of the covariate methods by simulation scenario options (--scenarios, --study-replicates, --subjects) the synthetic projects and the sensitivity, false-positive rate and recovery of the covariate engines 29
power sample size and power by SSE or by the Fisher information control stream, design dataset, --test effects power_scenarios.csv, fim_power.csv or sse_power.csv, sample_size.csv, plots/, report.html 30, 31
er exposure-response analysis subject-level dataset, optional .er settings model tables, figures, report.html 32, 33
ask Maxson, the assistant: plain words in, checked commands out a request; optionally a model file a session folder with transcript.md, commands.txt, ask_log.jsonl 34, 35
schema the annotated configuration reference none text, TOML or JSON on the console 7, 37
version the version banner (also --version; --license for the licence) none text on the console 2

Four things are worth noticing in the table.

  • Most commands take the files you already have. qc-data, eda, nca, autoinit and screen need only a dataset; fit needs a control stream and its dataset; the later commands need the files of a fit.
  • Results are files. Every command that estimates or simulates writes tables as CSV, so any later tool, including R or Python, can pick them up.
  • Aliases and old names. qc is an alias of qc-data; example is an alias of generate; run is the name that cov had before version 3.8.0 and still works.
  • Settings files have their own extensions. The settings of eda end in .eda, those of nca in .nca, and so on (Section 4.1 and Chapter 7), so a file says which command it is for.

1.2.3 A first look at the program's own description

nlmx version prints the same list in the terminal, with a one-line description of each command. The banner is shown in full in Section 2.1; its last block is the one to remember:

COMMANDS
  qc-data         quality control of a NONMEM dataset (99 checks)
  qc-nm           quality control and correction of a control stream
  eda             exploratory plots and tables of a PK/PD dataset
  nca             non-compartmental analysis, tables, report and plots
  autoinit        initial estimates from the dataset alone
  screen          structural-model screen (1-3 compartments, TMDD)
  fit             estimate a control stream: FO, FOCE, FOCE-I, Laplace, SAEM
  cov             covariate selection (frozen | posterior | both)
  vpc             visual and numerical predictive checks
  forest          forest plots of covariate effects and exposure
  sims            simulate a study: dataset, exposure metrics, summary, plots
  power           sample size and power: SSE and Fisher information
  er              exposure-response: Emax, logistic, Kaplan-Meier, Cox
  ask             Maxson, the assistant: runs analyses or guides you
  generate        synthetic NONMEM projects of any design
  simulate-study  operating characteristics by simulation
  inspect         parse and summarise the inputs; `validate` checks them
  posterior       subject posteriors and shrinkage only
  resume          continue an interrupted run
  schema          the annotated configuration reference

nlmx <command> --help lists the options of one command under headings of its own; Section 4.5 explains how to read that help.

1.2.4 Choosing where to start

You have and want Start with Then
a new dataset to know whether it is fit for modelling qc-data eda, nca
a dataset and no model a first structural model autoinit screen, then fit
a control stream you wrote to check it qc-nm fit
a fitted base model to test covariates inspect, then cov fit the draft, then forest
a fitted model to check it by simulation vpc fit --plots for the goodness of fit
a fitted model a sample-size estimate power --method fim power --method sse for a stochastic check
a fitted model the exposure of a planned design sims er, when response data exist
nothing yet to learn the program generate Chapter 3