Chapter 29 — generate and simulate-study
nlmx generate creates complete NONMEM-style projects from stable examples, configurable known-truth designs, or an existing dataset. nlmx simulate-study repeats a fixed known-truth generate–fit–analyse workflow and measures how covariate-selection engines behave across scenarios. Together they support teaching, validation fixtures, method development, design stress testing, recovery studies, and reproducible regression testing.
What you will learn
- how preset, synthetic-design, and existing-dataset generation modes differ;
- every structural, group, regimen, sampling, truth, variability, covariate, estimation, and output control;
- what files form a generated project and how they feed later nlmx commands;
- how the five built-in simulation-study scenarios alter information or covariate structure;
- how frozen, posterior, and refit-based SCM decisions are compared with true, null, and proxy relationships;
- the exact denominators and implementation definitions of sensitivity, false-positive rate, proxy selection, exact recovery, agreement, bias, and RMSE; and
- how failures, small replicate counts, and current version limitations constrain interpretation.
Executed nlmx 4.14.3 evidence
Four generated projects and five simulation-study exercises were executed and preserved under documents/ch29/results:
- a configurable two-compartment oral project with three dose groups, four doses, 45 subjects, four true covariate effects, fitted run101, and fitted run102;
- the stable 200-subject analytic preset;
- a project built and fitted around the Chapter 22 existing dataset;
- a 16-subject three-compartment
$DESinfusion design intentionally created with--no-fit; - a rich/sparse study with two replicates, 50 subjects, and both frozen and posterior engines;
- a rich one-replicate study with frozen and SCM reference engines;
- high-shrinkage, correlated, and rare-category stress scenarios;
- two otherwise identical one-replicate studies issued with seeds 111 and 999999 to test seed behavior.
The custom project's base model converged at OFV -1180.3308 and its fitted true-covariate model at -1231.1331. Its fitted coefficients were 0.5749 for CLEGFR (truth 0.6), -0.2888 for CLSEX (truth -0.2 on the fitted proportional scale), 0.9441 for CLWT (truth 0.75), and 0.9471 for V2WT (truth 1.0). These are one-project teaching results, not estimator operating characteristics.
Accuracy corrections captured in this chapter
The implementation audit and executed runs identified several details that are easy to misstate:
- In nlmx 4.14.3,
simulate-study --seedis not consumed by the study loop. Seeds 111 and 999999 generated byte-identical datasets with SHA-256BFEA92068C17269AA1636949F0841E6B4A2DBB2129F5C89CF84F11148211BBFB. - Current exact recovery requires every true relationship retained and every null relationship not retained; proxy selection is ignored by that metric.
- Agreement compares retained versus not retained, so uncertain and rejected decisions are equivalent for agreement.
- Failed engine replicates contribute no relationship rows and reduce the completed replicate count. The executed high-shrinkage frozen replicate failed because its fitted OMEGA was not positive definite.
- There is no standalone
study_failures.csvin this version; failures are written instudy_report.mdand represented by missing rows and completed denominators.
These observations document current behavior; they do not modify nlmx source files.
How to read the chapter
Pages 29.1–29.10 cover generate, from command choice through project handoff. Pages 29.11–29.18 cover the simulation-study pipeline, truth, scenarios, engines, reproducibility, and metric definitions. Pages 29.19–29.20 explain outputs and Monte Carlo interpretation. Pages 29.21–29.23 interpret the executed projects and studies. Page 29.24 provides a validation, training, scaling, and reporting framework.
Use the complete command and settings index for an option-by-option lookup. The numbered pages explain the scientific question, implementation behavior, QC evidence, and common mistakes behind each control.
This chapter describes nlmx 4.14.3. Synthetic truth supports controlled verification and operating-characteristic experiments; it does not establish clinical truth, external validity, or equivalence to NONMEM, PsN, Monolix, or another implementation without a prespecified cross-software validation study.