Documentation

30.7 Stochastic simulation and estimation

Stochastic simulation and estimation

Stochastic simulation and estimation (SSE) repeatedly runs the proposed study in silico. Each replicate generates new subjects and observations under a declared truth, re-estimates the planned models, applies the planned test, and records success or failure. The rejection fraction estimates power, while the same replicate bank can quantify bias, precision, coverage, shrinkage, convergence, and runtime.

Concepts to keep separate

  • A scenario defines sample size, allocation, schedule, dropout, missingness, compliance, effect multiplier, and analysis settings.
  • A replicate is one complete synthetic trial, not one observation or one subject.
  • The generator and estimator should be separable artifacts so same-model recovery is not mistaken for external validation.
  • Every aggregate must trace to row-level replicate records, including failures and test-specific status.

Terminology matters because a single scenario can contain several denominators and several sources of randomness. Truth is the parameter vector used to generate a replicate. Estimate is the value recovered from that replicate. Design is the planned arrangement of subjects, arms, doses, and observations. Method is the approximation or simulation–estimation procedure used to predict performance. A credible report labels all four.

Mathematical or operational walkthrough

The Chapter 30 smoke run simulated and fitted 20 trials at N=40 and 20 at N=80. It observed powers 0.85 and 1.00, respectively. Those values demonstrate the workflow; the wide intervals show why 20 replicates are not sufficient for a protocol claim.

For novices, read every expression from the inside out: identify the scientific effect, identify the null value, put both on the same parameter scale, identify the variance or information that belongs to the actual design, and only then calculate a test statistic or sample size. Units and parameterisation should cancel in a way that leaves a dimensionless statistic.

How this maps to nlmx

SSE is computationally expensive because one replicate may require a full fit, one reduced fit per hypothesis, and a covariance step. Use a small smoke phase to expose setup errors before launching production replication.

Chapter 30 explains the statistical and implementation concepts. Chapter 31 gives the complete nlmx power command, every CLI and settings control, precedence, output schema, and production workflow. This separation is deliberate: choosing an option correctly requires understanding which estimand and assumption it changes.

Quality-control checklist

  • Can one replicate be reconstructed from preserved settings and seed?
  • Are full and reduced fits saved or diagnosable?
  • Do summaries expose completed and failed counts?
  • Are production replicate counts justified by Monte Carlo precision?

The graph is explanatory; the CSV, JSON, resolved settings, model inputs, and replicate rows are the authoritative evidence. When a plotted point looks surprising, diagnose the underlying rows before changing the design.

Common mistakes

  • Counting subjects as simulation replicates
  • Skipping re-estimation
  • Reporting a smoke run as final evidence

Also avoid copying a sample size from a nearby project. Power is conditional on the model, tested effect, covariate distribution, schedule, residual and random variability, attrition, test, estimator, and success criteria. Similar-looking studies can have very different information.

Evidence to retain

  • scientific question, estimand, hypothesis, alpha, target, and criteria;
  • model/data/design inputs, parameter source and uncertainty distribution;
  • software version, method, approximation, seed, threads, command, and resolved settings;
  • scenario grid, row-level results, failures, denominators, intervals, diagnostics, and checksums;
  • scripts that calculate derived tables and figures, plus the interpretation and limitations.

See the previous page, next page, and formula and decision index.