Documentation

Complete generate and simulate-study command and settings index

This is the versioned nlmx 4.14.3 interface reference for both Chapter 29 commands. It distinguishes command-specific behavior from shared parser options and records implementation behavior verified by executed workflows.

Complete Chapter 29 command map

Minimal command forms

# Stable example preset
nlmx generate --output demo
nlmx generate --output demo_ode --model ode
nlmx generate --output demo_iov --model iov-blq

# Described synthetic project
nlmx generate --output study --structure 2cmt-oral `
  --groups 3 --group-names "Low,Mid,High" --doses 50,100,200 `
  --subjects-per-group 40 --effects "CL~WT=0.75,V~WT=1,CL~EGFR=0.6" `
  --covariate-model

# Project around an existing dataset
nlmx generate --data pk.csv --output project --structure 1cmt-oral

# Operating-characteristic study
nlmx simulate-study --output study_oc --scenarios rich,sparse `
  --study-replicates 20 --subjects 150 --method both

nlmx example remains an alias for generate.

Shared execution, logging, and output options

Option generate simulate-study
-o, --output DIR Required in normal use; project destination. Required; study root.
--overwrite Allows an existing nonempty destination. Prefer a new project folder. Required when study_summary.csv already exists. It does not convert failed evidence into a clean new generation.
-c, --config FILE .gen design/settings file. Covariate-analysis template used inside each generated replicate; its input must resolve to models/run101.
--threads N Used by fits/analysis work. Inner analyses use threads; top-level replicates are sequential.
--seed N Synthetic project seed; default 20260925. Displayed and accepted, but not consumed by the 4.14.3 study loop; see the verified limitation below.
--suppress-console, --log-file, --no-color, -v, -q Shared logging controls. Shared logging controls; root study output itself does not contain a separate top-level transcript unless explicitly routed.
--keep-subject-ids Relevant to existing-data privacy where shared machinery uses IDs. Generated IDs are synthetic.
--dry-run Shared validation path; does not replace inspection of the generated project. Shared parser option; use small real runs to validate the full nested pipeline.
-h, --help, --license Help/licence. Help/licence.
--print-config FILE.gen Writes annotated generate settings. Not a study-design template; use a covariate .covar configuration through -c.

Shared parser options such as --run-dir, --no-checkpoint, schema --format, and publication --plots do not define the top-level project/study design. --no-checkpoint may affect an inner posterior engine when the shared covariate workflow consumes it, but it is not a substitute for the study's replicate folders.

Selecting the generate mode

Trigger Mode Important consequence
No design option; optional `--model analytic ode iov-blq`
Any design option or -c FILE.gen Described synthetic design User controls structure, groups, truth, population, estimation, and outputs.
--data FILE Existing dataset No data are simulated; truth/groups are absent; design-generation flags are refused or ignored by settings table.

--approximation without a described design or --data is refused because presets keep their defined estimation method.

generate: structure and residual model

Option Values/default Behavior
--model PRESET analytic Preset only: analytic, ode, iov-blq.
--structure STRUCTURE 1cmt-oral 1cmt, 2cmt, or 3cmt + oral, iv, or infusion; optional lag for oral.
--compartments N from structure 1, 2, or 3; shared option accepted by design resolver.
--route ROUTE from structure oral, iv/bolus, or infusion. The shared help text is broader because the option is also used by screening.
--lag MODE no yes enables ALAG for oral; non-oral lag is refused.
--ode off Write ADVAN13 $DES instead of analytic ADVAN/TRANS.
--error MODEL combined combined, proportional, or additive. The tailored help groups it under screen, but design generation consumes it.

Analytic structures map to ADVAN1/2/3/4/11/12 as appropriate. Generic parameter names are CL, V, Q, VP, Q2, VP2, KA, and ALAG; generated code maps them to route/structure-specific compartments.

generate: treatment groups, regimen, and sampling

Option Default Behavior
--groups N number of supplied doses, else 1 One to 50 groups.
--group-names LIST Group 1, … One name per group.
--doses LIST 100 One dose recycled or one per group; all positive.
--subjects-per-group LIST none One count recycled or one per group.
--subjects N 100 total Split as evenly as possible when per-group counts are absent. For simulate-study, subjects per generated dataset.
--n-doses N 1 ADDL = N − 1.
--dose-interval H 24 II between doses.
--infusion-duration H 1 Positive duration for infusion designs.
--sample-times LIST route/structure defaults Positive hours after the first and, for repeated dosing, last dose as resolved by the generator.
--sparse-samples N all Randomly retain N protocol sample times per subject.
--lloq NUMBER none For generated data, below-limit observations receive BLQ=1, MDV=1, DV=0. Although shared help emphasizes other commands, generate consumes a numeric value.

Synthetic-design flags that cannot be combined with --data are --groups, --group-names, --doses, --subjects-per-group, --subjects, --n-doses, --dose-interval, --infusion-duration, --sample-times, --sparse-samples, numeric --lloq, and --no-covariate-effects.

generate: truth and variability

Option Default Behavior
--typical LIST CL 3.2, V 42, Q 5, VP 80, Q2 1.5, VP2 120, KA 1.1, ALAG 0.5 Comma-separated NAME=VALUE; only parameters in the selected structure are used. In existing-data mode these are starts, not truth.
--iiv LIST CL 30%, V 25% CV percentages, 0–300; zero removes the ETA.
--prop-error CV 15% Positive unless additive-only model.
--add-error SD 0.02 Positive unless proportional-only model.
--effects LIST CLWT=.75, VWT=1, CL~EGFR=.6 in synthetic mode PARAM~COV=VALUE; existing-data mode also accepts effect names without values for fitting.
--no-covariate-effects off Clears all synthetic truth effects.
--covariate-model off Synthetic mode: also estimate the declared truth relationships in run102.

Supported generated covariates are WT, AGE, SEX, EGFR, and CRCL. Continuous truth is TVP × (COV/reference)^coefficient; SEX truth is TVP × factor^SEX. The fitted binary form is proportional, so factor 0.8 corresponds to THETA -0.2.

generate: fitting and project metadata

Option Values/default Behavior
--approximation METHOD foce-i fo, foce, foce-i, laplace, or saem; written to control streams and used by the fit.
--max-iterations N fit default Shared fit limit for generated fits.
--no-fit off Write design/data/control streams/settings without fitting.
--author NAME Obinna Obianom Header author in generated control streams.
--method METHOD not a generate design choice Appears through shared covariate parser and can influence generated configuration defaults, but does not replace the explicit fit approximation.

Complete .gen settings schema

nlmx generate --print-config nlmx.gen is the authoritative current template.

Table Keys
[data] file
[design] structure, ode, error
[groups] names, doses, subjects
[regimen] n_doses, interval, infusion_duration
[sampling] times, sparse, lloq
[parameters] CL, V, Q, VP, Q2, VP2, KA, ALAG
[variability] inline iiv, proportional_error, additive_error
[covariates] inline effects, covariate_model
[population] wt_median, wt_cv, age_mean, age_sd, p_sex, egfr_median, egfr_cv, crcl_noise
[estimation] approximation
[output] seed, fit, author

CLI overrides corresponding settings. Relative input paths resolve using configuration loading rules; every generated project writes a resolved nlmx.gen for rebuilding into a new output folder.

Existing-dataset requirements and transformation contract

  • Required header names after case normalisation: ID, TIME, AMT, DV.
  • Optional event columns: EVID, MDV, CMT, RATE, ADDL, II, SS.
  • Delimiters: comma, tab, or whitespace; every row must have a value for each column.
  • Names become uppercase, non-name characters become _, leading digits gain C, names are limited to 20 characters, and duplicates gain suffixes.
  • Names colliding with model variables such as CL, V, Q, KA, IPRED, W, Y, or S1 are renamed with _D.
  • Empty/NA/NaN becomes ., text columns remain in data but are DROPped in $INPUT, text IDs are numbered with id_map.csv, and DATE/DAT1–DAT3 are dropped.
  • Data-derived starts use AUC, terminal slope, and peak-time summaries when adequate information exists; explicit truth/start options override them.

Existing-data mode supports one error model, no automatic IOV/M3 or multiple-DV scaffolding, and cannot know units. Complex analyses should use a reviewed control stream and fit directly.

Generated-project output contract

Artifact Synthetic design Existing data
data/analysis.csv Simulated NONMEM dataset. Normalised copy of supplied data.
data/id_map.csv Usually absent. Present when text IDs are remapped.
truth.ctl Generating model with true values. Absent.
groups.csv Group, name, dose, subjects. Absent.
models/run101.* Base fitted family unless --no-fit. Base fitted family unless --no-fit.
models/run102.* Present with --covariate-model and nonempty effects. Present with requested --effects.
nlmx.covar Covariate analysis of run101. Candidate scope based on suitable dataset columns.
nlmx.vpc pcVPC, with GROUP/BLQ controls when applicable. pcVPC for supplied design.
nlmx.forest With fitted run102. With fitted effect model.
nlmx.gen Resolved generator design. Resolved dataset/project specification.
README.md Design, truth, fits, next steps. Transformations, starts, fits, next steps.
checksums.sha256 Written by the executed described synthetic designs. The stable preset did not emit it in 4.14.3. Not emitted by the executed existing-data project in 4.14.3; create an external recursive hash manifest for archival.

simulate-study design options

Option Default Current behavior
--output DIR required Study root.
--model PRESET analytic analytic, ode, or iov-blq.
--subjects N 100 Subjects in every generated dataset.
--study-replicates N 5 Requested datasets per scenario; coerced to at least 1.
--scenarios LIST rich,sparse Any comma-separated subset of rich, sparse, high-shrinkage, correlated, rare-category; underscores normalise to hyphens.
--method METHOD frozen + posterior Exactly frozen selects frozen; exactly posterior selects posterior; other accepted shared values currently select both.
--scm-reference off Adds SCM and makes it the agreement reference for other engines.
-c FILE.covar built-in template Engine/scope configuration copied into each replicate; input must point to models/run101.
--threads N all cores Inner fit/engine parallelism.
--seed N documented as master seed Not consumed by the 4.14.3 study loop.

Because generate and simulate-study share a CLI option group, simulate-study --help also displays generate-only controls such as --structure, --groups, --doses, regimen/sampling controls, truth parameters, IIV/error controls, effects, --covariate-model, --author, --ode, and --no-fit. The top-level 4.14.3 study implementation does not read these controls; it builds its fixed preset scenarios. Do not imply that passing them customises the operating-characteristic design.

Built-in scenarios

Scenario Sampling/covariate change Intended stress
rich Ten samples, ordinary covariate generator/error Baseline information-rich recovery.
sparse 2, 23.9, 100 h Sparse individual information.
high-shrinkage 23.9 and 108 h; doubled proportional error Weak individual effects, shrinkage, fit instability.
correlated Rich times; EGFR–WT log-scale correlation 0.7 Collinearity and proxy/competition behavior.
rare-category Rich times; SEX=1 prevalence 8%; CL factor 1.4 Rare categorical effect and minimum-level support.

Built-in truth map

Relationship Ordinary scenarios Rare-category Metric role
CL~WT:power 0.75 0.75 true
V~WT:power (V2 for IOV/BLQ) 1.0 1.0 true
CL~EGFR:power 0.6 0.6 true
CL~CRCL:power no direct effect no direct effect proxy, not true/null
CL~SEX 0 factor 1.4 null ordinarily; true in rare-category

The frozen/SCM true coefficient for rare-category proportional SEX is 0.4; the posterior truth value is log(1.4).

Metric definitions as implemented

Metric 4.14.3 calculation
sensitivity Retained true rows / all completed true rows. Uncertain is not retained.
false_positive_rate Retained null rows / completed null rows; missing when no null exists.
proxy_selection_rate Retained proxy rows / completed proxy rows.
exact_recovery Completed replicates in which every true row is retained and every null row is not retained, divided by completed engine replicates. Proxy selection is ignored.
agreement_with_reference Retained/not-retained concordance across matched relationships; SCM is reference when present, otherwise frozen is reference for posterior. Uncertain and rejected are both not retained.
mean_seconds Mean engine elapsed seconds across completed engine replicates.
retained_rate Per relationship: retained rows / completed rows.
uncertain_rate Per relationship: uncertain rows / completed rows.
bias Mean finite estimate − engine-scale truth value.
RMSE Square root of mean squared finite-estimate error from truth.

simulate-study output contract

Artifact Content
study_results.csv Atomic scenario × requested replicate × completed engine × relationship rows: truth, classification, evidence, estimate, seconds.
study_summary.csv Per scenario × engine × relationship completed n, retained/uncertain rates, mean estimate, bias, RMSE.
study_metrics.csv Per scenario × engine completed replicates and operating metrics.
study_report.md Command, design, metrics, relationship summaries, and failures.
<scenario>/repNNN/data Generated replicate dataset.
<scenario>/repNNN/models Truth/base fit artifacts.
<scenario>/repNNN/nlmx.covar Replicate engine configuration.
<scenario>/repNNN/out_frozen, out_posterior, out_scm Engine-owned evidence when executed successfully.
checksums.sha256 Recursive study integrity manifest.

There is no study_failures.csv in nlmx 4.14.3. A failed base build produces no engine rows; a failed engine produces no rows for that engine/replicate. Failures appear in study_report.md, and study_metrics.csv.replicates is the completed count.

Verified seed limitation

The study loop derives its dataset seed as 20260926 + 7919 × scenario_index + 104729 × replicate_index. It does not read the CLI seed in 4.14.3. Scenario order is therefore also part of the generated stream: moving a scenario to another position changes its scenario index. Two executed rich/frozen studies with --seed 111 and --seed 999999 produced identical datasets with SHA-256:

BFEA92068C17269AA1636949F0841E6B4A2DBB2129F5C89CF84F11148211BBFB

Therefore, changing --seed is not an independent Monte Carlo repeat in this version. Preserve the command because it records user intent, but report the implementation limitation.

Minimum QC sequence

  1. Confirm command mode, source version, design, truth map, and engine configuration.
  2. Inspect generated event records, realised covariates, group counts, BLQ, and sparse samples.
  3. Review run101/run102 convergence, covariance, boundaries, and parameter mappings.
  4. For simulation studies, compare requested with completed replicate counts and read every failure.
  5. Trace aggregate metrics back to study_results.csv, especially proxy and uncertain decisions.
  6. Quantify Monte Carlo precision before comparing engines or scenarios.
  7. Verify command-generated checksums when present; otherwise create an external recursive hash manifest. Archive the complete project/study plus figure-regeneration scripts.

Syntactic support does not establish scientific validity. Validation claims require representative truth/design scenarios, prespecified metrics and tolerances, adequate replication, and independent cross-software comparisons where equivalence is claimed.