4.5 Command-line grammar
nlmx has 22 commands and 396 options. They are not 22 separate vocabularies. The options form one flat set, shared by all commands, grouped in the help by topic. This section explains that design, how to find what you need, and the small grammars that options use for lists, repeated values and pairs.
4.5.1 One flat option set
Every option is valid in the position after the command, whichever command it is. nlmx fit run.ctl --seed 7 and
nlmx sims run.ctl --seed 7 use the same --seed; --threads, -o, -c, --overwrite and the logging options do the
same everywhere. Options that belong to one command say so at the start of their help ("nca: BLQ rule: …",
"vpc: data column flagging …"), and an option given to a command that does not use it is accepted and ignored, so a
common set of options can be kept in a script and used for several commands.
The reverse also holds: the same idea has the same name in the commands that need it. --lloq is the lower limit of
quantification of vpc, autoinit and screen; --method selects the engine of the covariate analysis and, in
power, the method; --blq-action is the BLQ handling of sims and power. When you learn an option in one command, you
have learned it in the others.
4.5.2 Finding an option: help headings
nlmx --help lists the commands. nlmx <command> --help shows the options of the command, grouped under headings, and
nlmx --help itself shows the whole set under about 30 headings. The headings are the map.
Table 4.2. The help headings of the options, and what each holds.
| Heading | What it holds | Examples |
|---|---|---|
| Core | the options of every command | -c, -o, --overwrite, --dry-run, --run-dir |
| Input selection | where the NONMEM files come from | --model-dir, --files, --ctl, --ext, --cov, --run-stem, --recursive |
| Method | the engine and the threads | --method, --threads |
| Covariates | the candidates, equations, references of the covariate analysis | --covariates, --continuous-forms, --covariate-reference |
| Frozen method, Posterior method | the two covariate engines | --approximation, --refine, --replicates, --learners |
| Shared numerics | seed and numerical guards | --seed, --ridge-max, --strict |
| Logging and output | console, log, colour, licence | -v, -q, --log-file, --no-color, --license |
| QC | qc-data and qc-nm |
--fail-on, --skip-checks, --list-checks, --tad-col |
| EDA, NCA | exploratory plots and non-compartmental analysis | --eda-plots, --auc-method, --blq-rule, --lz-method |
| Autoinit, Screen, Dataset (autoinit, screen) | initial estimates and the structural screen; the dataset columns they use | --init-method, --compartments, --id-col, --mutate |
| Fit | the estimation | --max-iterations, --cov-step, --saem-iter, --print-options |
| VPC, Forest | predictive checks and forest plots | --vpc-type, --stratify, --forest-covariates, --reference-band |
| Sims (seven headings) | population, dosing, simulation, metrics, figures | --dose, --sim-etas, --metrics, --summary-by |
| Power | sample size and power | --sample-sizes, --test, --replicates, --target-power |
| Exposure-response (er) | exposure-response analysis | --er-type, --placebo, --event-col |
| Ask (Maxson) | the assistant | --llm-backend, --yes, --plan-only |
| Generate and simulation study | synthetic projects | --subjects, --structure, --groups, --doses |
| Plots | the figure style of several commands | --plots, --plot-dpi, --plot-format |
The reference chapter (Chapter 36) lists every option under these headings, command by command. Two options help you work with the set:
--print-config FILE.<ext>writes the command's annotated settings template, with every key and its default, and stops. It is the way to start a settings file, and the reference for what can be set.--print-options(forfit) writes out every estimation setting, including those taken from the control stream's$ESTIMATION, as one command line. The line is also saved infit_command.txt(Section 4.2).
nlmx schema prints the reference of the .covar file (as text, TOML or a JSON Schema for an editor).
4.5.3 The grammar of values
Lists are comma-separated, with no spaces: --sample-sizes 40,80,120,160, --forest-covariates WT,EGFR,
--covariates WT,SEX,EGFR,CRCL. A value that contains a space is quoted, as the shell requires: --test "CL~WT=0.75"
(quoted here because ~ and = can be special to a shell).
Repeatable options may be given several times, and each occurrence adds: --covariates CL=WT,AGE --covariates V=WT.
Some also accept ; between items in one occurrence.
Pairs KEY=VALUE are the grammar of options that attach a value to a name: --covariate-reference WT=70,
--covariate-type DOSE=categorical, --covariate-labels WT=Weight, --schedule NAME=TIMES, --rse-limit LABEL=PCT. The
name is a column or a label; the value follows the option's own rules.
Mini-languages. Four options take a small language in a quoted string:
| Option | Language | Example |
|---|---|---|
--test |
PARAMETER~COVARIATE=VALUE |
--test "CL~WT=0.75" (the effect to detect, Section 3.6) |
--mutate |
assignments in R syntax | --mutate "DV=DV*1000" |
--filter, --obs-filter, --gof-filter |
a condition in R syntax | --filter "SEX == 1" |
--covariate (in sims) |
NAME=DIST(…) |
the distribution of a simulated covariate |
The R-syntax subset is the same in all of them (Chapter 7), and an expression that cannot be read stops the command with a configuration error that names it.
Two forms of --covariates. The most common mistake in the grammar is this one. In cov, inspect, validate and
run, --covariates is a list of PARAMETER=COVARIATES pairs, because a covariate is tested on a parameter:
--covariates CL=WT,EGFR --covariates V=WT. In qc-data, qc-nm, eda, nca, er and the other commands that only
describe columns, --covariates is a plain list of column names: --covariates WT,SEX,EGFR. The second form stopped
with an error in versions before 4.2.1 (Section 2.5); a command that takes the plain list refuses the pair form with exit code 2 and a hint
(qc-data --covariates CL=WT ends with "PARAM=COVS is for run"), and the help of each command says which it takes.
4.5.4 Settings files and the command line
A settings file and the command line say the same things in two forms, and the command line wins. A key in the
settings file has the same name as its option without the dashes and with underscores (stratify_on in [vpc] is the
option --stratify; samples is --samples; the tables follow the topics). The message "command-line overrides
applied: samples=500, seed=…" in the log lists what the command line changed. Use the settings file for what defines
the analysis, and the command line for what you vary: nlmx vpc -c nlmx.vpc --samples 100 --no-plots is a check run of the
same settings.
A settings file is TOML, with a fixed extension per command (Table 4.3 in Section 4.1), unknown keys are errors, and
--print-config writes the template. Chapter 7 describes the system.
4.5.5 Reading the help
Three habits make the help readable:
- Start from the heading.
nlmx fit --help | lessshowsFit, then the shared headings. Look for the group, not the alphabet. - Read the first words of an option's description: they name the commands it applies to.
- Look for the default at the end of the description ("(default: foce-i)"); a default that depends on the data says "as in the data".
Common mistakes
--covariates WT,SEXforcov. The covariate analysis needs the parameter:--covariates CL=WT,SEX.- An option that does nothing. Options that do not apply to the command are ignored; check the first words of the help.
- A list with a space.
--sample-sizes 40, 80is two arguments; write40,80. - An unquoted
~or=in--test. Quote it.
Checklist
- The settings that define the analysis are in a settings file under version control.
-
--print-configwas used for the template, not an old file copied from another project. - The options you vary are on the command line, and the log shows "command-line overrides applied".
Further reading
Chapter 7 (the settings system), Chapter 36 (the command-line reference), Chapter 37 (the settings reference).