Trial biostatistics toolkit

Worked example: one synthetic BE study

A synthetic bioequivalence study, from sample size to CSR text

Runs: study/run_all.RSynthetic data

Synthetic data only: simulated for this worked example; not real trial data and not a regulatory deliverable.

One synthetic early-phase bioequivalence study, taken from sample size to clinical study report text. Every number on this page and on the pages it links to comes from one script, study/run_all.R, run on synthetic data. The study builds on the sim_lifecycle/ sandbox (same priors and model, a 2x2 crossover, N = 40, seed 2026).

Run all six study stages in your browser

Reproduce the fixed synthetic SIMBE01 study in the browser, including transport files, TLFs, the QC ledger and CSR text. HTML replaces Quarto presentation; the study and SAP assumptions remain fixed. No local R, command line, account or toolkit download is required. Save results before reloading.

  1. Design40 enrolled; 38 evaluable for 90% power
  2. SAP and shells6 table shells
  3. ADaM24 of 24 metadata checks passed
  4. Analysis and TLFsCmax 101.07% (90% CI 98.89 to 103.30)
  5. QC40 of 40 checks (same-author)
  6. CSR text10 of 10 paragraphs number-checked

Stage 1

Design: sample size and randomization

Runs here

What was executed

Artifacts

Not covered: BOIN/CRM dose-escalation designs, adaptive or group-sequential designs.

Stage 2

Statistical analysis plan and mock shells

Settings drive the code

What was executed

Artifacts

Stage 3

SDTM-like inputs, ADaM, specification and XPT

Runs here

What was executed

Artifacts

Not covered: define.xml and the ADRG are not authored; no Pinnacle 21 or CDISC CORE run; the inputs are SDTM-like, not conformant SDTM.

Stage 4

NCA, bioequivalence analysis and TLFs

Runs here

What was executed

Artifacts

Not covered: Phoenix WinNonlin and SAS were not used.

Stage 5

QC: re-derivation by a second method

Same-author re-derivation

What was executed

Artifacts

Not covered: This is same-author re-derivation: the same person wrote both routes. No second programmer re-derived the results.

Stage 6

CSR section 11-style text, checked against the outputs

Number check

What was executed

Artifacts

Not covered: The validator checks that numbers exist in the outputs, not that statements are correct. No language model runs in this pipeline; the text is filled into fixed sentence templates (written with an AI coding assistant) and still needs a statistician's review.

Optional native reproduction

Rscript -e 'install.packages("renv"); renv::restore(project = "study", prompt = FALSE)'  # packages pinned in study/renv.lock
Rscript study/run_all.R        # from the repository root; regenerates every output above

run_all.R runs the stages in order and renders the report with Quarto. renv.lock pins R 4.6.0 and the package versions below. Two consecutive local runs produced byte-identical files. The CI workflow .github/workflows/study.yml (r-lib/actions v2) runs it on Ubuntu and fails if a committed output changes; the figures and the rendered report are excluded from that byte check because PNG rendering depends on system fonts. Its run history is public; it first passed on main on 25 October 2026.

Package versions (renv.lock)
Package versions used by this run (pinned in renv.lock).
PackageVersion
admiral1.5.0
metacore0.3.0
metatools0.3.0
xportr0.6.0
datasetjson0.4.1
PKNCA0.12.1
NonCompart0.8.4
PowerTOST1.5-7
blockrand1.5
rtables0.6.17
tern0.9.13
formatters0.5.13
r2rtf1.3.1
diffdf1.1.2
dplyr1.2.1
ggplot24.0.3
knitr1.51
rmarkdown2.31
openxlsx4.2.9
renv1.3.1

Not covered by this example. define.xml and ADRG authoring; Pinnacle 21 or CDISC CORE conformance; conformant SDTM; independent double programming by a second person; a validated (21 CFR Part 11) system; a regulatory submission package; interim analyses and a DMC. The study, product and every participant are simulated.