Documentation

36.7 fit command reference

fit command reference

This chapter is a lookup reference for nlmx 4.16.1. Option tables are generated from the installed release executable. Read an option in the context of the command page: nlmx uses a global parser, but an accepted option can be irrelevant to a command unless its help text names that command or the command's method chapter defines the behavior.

The safe sequence is: identify the installed version, open that command's help, freeze input/settings/output paths, run into a new or empty output directory, inspect both the process status and the command-native verdict, and retain the log/resolved settings/checksums. A command line is reproducible only when its referenced files and software version are also frozen.

Synopsis

nlmx fit [OPTIONS] [CONTROL_STREAM]

Required context. A NONMEM control stream (.ctl/.mod) and its referenced dataset; optional patterns through --ctls for batch fitting.

What it does. Estimates the population model with FO, FOCE, FOCE-I, Laplace, or SAEM; supports covariance, retry strategies, batch control streams, diagnostics, and report generation.

Principal outputs. NONMEM-style .ext, .cov, .cor, .coi, .phi, final control stream, predictions/residuals, parameter tables, GOF plots, report, resolved command/settings, logs, and checksums.

Positional arguments shown by installed help

[CONTROL_STREAM]
          Control stream to estimate (.ctl/.mod); same as --ctl

Practical invocations

  1. nlmx fit models/run101.ctl -o run101_fit
  2. nlmx fit models/run101.ctl --approximation foce-i --retry robust --plots

Start with installed help and, when available, generate the complete settings template before entering study choices. Run into a new or empty output folder. After completion, review the command's native summary/verdict, warnings, logs, resolved settings, and checksum manifest—not only the console's final line.

Complete installed option reference

The following 72 options are parsed directly from nlmx 4.16.1 fit --help. The unmodified txthelp snapshot and its SHA-256 are preserved in the jsonhelp inventory. Shared descriptions sometimes mention several commands; apply only the clause naming fit unless its method chapter specifies otherwise.

Options

Option Installed description
-h, --help Print help

Method

Option Installed description
--method <METHOD> Selection engine: frozen | scm (stepwise forward/backward on refits) | posterior | both (overrides method in the config)
--threads <THREADS> Worker threads for subject- and replicate-level parallelism (default: all cores). Results do not depend on this value

Input selection

Option Installed description
--model-dir <MODEL_DIR> Directory holding one NONMEM run family, matched on a common stem (e.g. run101.ctl/.ext/.cov); power: the folder with the run's <stem>.ext and <stem>.cov
--files <MANIFEST.txt> Explicit [files] manifest (.txt); paths resolve against the manifest location
--ctl <CTL> Control stream (.ctl/.mod)
--ctls <PATTERN>... fit: run fit once for every control stream matching the patterns (file names, folders, or wildcards * ? and ** such as *.ctl or ./xyz/*.mod), each with all the other options (--retry, --approximation, ...); every run has its own output folder (<name>_fit next to its control stream, or <output>/<name> with --output) and log
--ext <EXT> Final estimates (.ext); sims: the parameter values of --estimates final; power: the final estimates (default: those of the control stream)
--cov <COV> Parameter covariance matrix (.cov); sims: with it every simulation of the study uses a new parameter set (parameter uncertainty); power: needed for --uncertainty
--cor <COR> Parameter correlation matrix (.cor)
--data <DATA> Analysis dataset (overrides $DATA); sims: simulate this dataset instead of generating one
--lst <LST> NONMEM listing (.lst)
--phi <PHI> Individual estimates (.phi)
--table <TABLE> Table file with ID and ETA columns (.tab), used when no .phi is available
--run-stem <RUN_STEM> Disambiguate a directory containing several runs
--recursive Scan --model-dir recursively (still rejects ambiguity)

Core

Option Installed description
-c, --config <FILE> Settings file of the command (TOML syntax), with the command's extension: .covar (cov, posterior, inspect, validate, fit), .qcd, .qcn, .eda, .nca, .init, .screen, .vpc, .forest, .sims, .er, .power, .gen, .ask
-o, --output <OUTPUT> Output directory
--run-dir <RUN_DIR> Existing run directory, for resume
--overwrite Allow writing into a non-empty output directory
--dry-run Run the validation pipeline instead of the full analysis
--no-checkpoint Do not write replicate checkpoints (posterior engine)

Frozen method

Option Installed description
--approximation <APPROXIMATION> Likelihood approximation: auto (from $ESTIMATION, default) | fo | foce | foce-i | laplace; fit and screen also accept saem (SAEM with an importance-sampling objective); screen default foce-i
--uncertainty Enable MVN resampling of the frozen parameters from the .cov

Shared numerics

Option Installed description
--seed <SEED> Master seed (uncertainty draws, resampling, posterior draws, vpc simulations, autoinit ML)
--strict Promote every warning to an error

Logging and output

Option Installed description
--suppress-console <0|1> 0 (default) prints progress to the terminal; 1 silences it (the log is still written)
--log-file <LOG_FILE> Write the transcript here instead of log_<id>.txt
--no-color Disable ANSI colour
--license Print the license (CC BY-ND 4.0), the third-party components, how long this version may be used and how to contact the author, and stop
-v, --verbose... Increase verbosity (repeatable: info -> debug -> trace)
-q, --quiet Errors only on the terminal (the log file is unaffected)
--keep-subject-ids Do not hash subject identifiers in outputs
--format <FORMAT> Output format for schema: txt | toml | json | json-schema [default: txt]

Generate and simulation study

Option Installed description
--model <EXAMPLE_MODEL> generate, simulate-study: preset project: analytic (default) | ode | iov-blq

Fit

Option Installed description
--max-iterations <MAX_ITERATIONS> fit, screen: maximum estimation iterations (default 300, or 0 when $EST has MAXEVAL=0); 0 only evaluates the objective and individual estimates at the initial values
--gradient-tolerance <GRADIENT_TOLERANCE> fit, screen: gradient tolerance on the internal (transformed) scale (default 1e-3)
--cov-step fit, screen: run the covariance step even without $COVARIANCE
--no-cov-step fit, screen: skip the covariance step even when $COVARIANCE is present
--retry <N> fit: retry a failed estimation up to N times (0 to 10, default 0 = no retry). A run fails when it stops with a numerical error or does not converge. Retry 1 starts from the autoinit estimates of the dataset, each further retry from those values changed at random by up to +/-15% (--seed); the retries are written to <output>/retries/ and the first one that converges ends the loop
--cov-matrix <COV_MATRIX> fit: covariance matrix: rsr (sandwich, NONMEM default) | r | s (default: $COV MATRIX=)
--start-from-ext fit: start from the estimates in --ext instead of the control stream's initial values
--stem <STEM> fit: file stem for the NONMEM-format outputs (default: the control stream's stem)
--saem-burn <SAEM_BURN> fit (SAEM): maximum burn-in iterations (default: $EST NBURN, else 1000; ends earlier once stationary unless NBURN was set explicitly without CTYPE)
--saem-iter <SAEM_ITER> fit (SAEM): accumulation iterations with step size 1/k (default: $EST NITER, else 300)
--saem-chains <SAEM_CHAINS> fit (SAEM): MCMC chains per subject (default: $EST ISAMPLE, else 2)
--is-samples <IS_SAMPLES> fit (SAEM): importance-sampling draws per subject for the objective and the covariance step (default: ISAMPLE of a following $EST METHOD=IMP, else 300)
--no-table fit: do not write predictions.csv (PRED, IPRED, residuals, ETAs per observation)
--carry-columns <COLS> fit: dataset columns also written to predictions.csv, comma separated (e.g. STUDY,DOSE); DVID is always carried when the dataset has it ([output] carry_columns)
--gof-back-transform <exp|exp10> fit: back-transform DV, PRED and IPRED before the goodness-of-fit plots: exp (the model is fitted on ln DV) | exp10 (on log10 DV); residuals are left as they are
--gof-stratify <COL> fit: also draw the goodness-of-fit plots for each level of this dataset column (e.g. DVID, STUDY, DOSE)
--gof-filter <EXPR> fit: observations kept for the goodness-of-fit plots, R syntax on dataset columns and the values of predictions.csv (DV, PRED, IPRED, TIME, CWRES, …, before any back-transformation), e.g. "TIME > 0 & DVID == 1"
--print-options fit: print the estimation settings of this control stream as command-line options, every one written out (approximation, iterations, tolerance, covariance step, SAEM), and stop
--keep-predose fit: keep in the estimation the observations taken before any drug was given (before the first dose, at its time with nothing absorbed yet, or of a subject without doses); by default they are left out when the model predicts 0 there, as their DV cannot be drug

Plots (vpc, fit, autoinit, screen, nca)

Option Installed description
--log-y vpc, fit: same as --y-scale log
--x-scale <SCALE> vpc, fit, autoinit: x axis of the plots: linear (default) | log (semi-log; values ≤ 0 are not drawn)
--y-scale <SCALE> vpc, fit, autoinit: y axis of the plots: linear (default) | log (semi-log; fit: the DV plots only)
--plots vpc, fit, autoinit, screen: also write publication plots to <output>/plots (PNG, theme_classic style)
--plot-width <W> plots: figure width in --plot-units (default 7 in)
--plot-height <H> plots: figure height in --plot-units (default 5 in)
--plot-units <UNITS> plots: units of width and height: in (default) | cm | mm | px
--plot-dpi <DPI> plots: resolution in dots per inch (default 300)
--plot-base-size <PT> plots: base font size in points (default 11, as ggplot2)
--plot-format <FORMAT> plots: png (default) | svg | both
--plot-colors <LIST> plots: colours as NAME=COLOUR pairs, e.g. median=#E41A1C,outer=#377EB8,points=grey (names: median, outer, observed, points, outside, reference)
--plot-no-title plots: no chart title (for a figure caption)
--plot-no-legend plots: no legend

VPC

Option Installed description
--legend-position <POS> vpc, fit, autoinit, screen: legend position on the charts: bottom (default) | top
--no-caption vpc, fit, autoinit, screen: no grey caption (check, observations, date) under the charts
--no-svg vpc, fit, autoinit, screen: write no SVG files at all (neither svg/ nor plots/svg/); PNG plots and the HTML report are unaffected

Dataset (autoinit, screen)

Option Installed description
--id-col <COLUMN> autoinit, screen: subject identifier column (default ID) er: subject column (default ID when present)

Autoinit

Option Installed description
--scale <EXPR> autoinit: the scaling of the target control stream, e.g. V/1000 for S1 = V/1000 (dose mg, concentrations ng/mL), V*1000, or a divisor (1000). Volumes and clearances are reported in its units and the NONMEM blocks carry the same S line

Interpretation and common failure

A numerical exit zero is not sufficient: review convergence, covariance status, boundaries, gradients, precision, shrinkage, residual diagnostics, and retry provenance. Retried estimates require the same qualification as any changed estimation method.

The detailed method and examples are in the relevant book chapter. Common nonzero process classes are documented on 36.35. A process exit of zero still requires command-native scientific and numerical review.

Minimal handoff record

Record the version, exact command and working directory, input/settings hashes, selected options and defaults, output path, process exit, native verdict or convergence state, warnings/exclusions, principal results with uncertainty, checksum verification, and reviewer disposition.

See the previous page, next page, and complete command index.