← All publications

Preprint

Human-Governed Validation of R Packages for Regulated Statistical Computing: LLM-Assisted Specifications and Auditable Test Evidence

Jaime Yan

Preprint (submitted to Pharmaceutical Statistics) · 2026 · sole author · under review

Download PDF

Abstract

Open-source R packages are increasingly used in regulated statistical computing, but risk scores, coverage, and upstream tests do not by themselves demonstrate fitness for an intended use. This preprint presents a specification-driven validation prototype: versioned specifications define requirements and acceptance criteria; an isolated engine combines known-answer, metamorphic, property-based, fuzz, and mutation tests; and records enter a tamper-evident hash chain. An optional local LLM drafts structure only — expected values are captured characterization baselines or independently derived, and approval remains human. A public contract replay passed 15/15 LLM authority-boundary checks including a prompt-injection red-team set. A pristine synthetic R package passed 11/11 cases spanning four test techniques while four pre-injected defect variants each failed the targeted requirement; a jsonlite replay surfaced the documented digits=4 precision semantics; a synthetic time-to-event capsule reproduced prespecified Kaplan–Meier and Cox outputs and passed 50/50 row-order invariance checks. Public artifacts include source, specifications, machine-readable outputs, replay scripts, and SHA-256 manifests. The results demonstrate test-oracle construction, fail-closed model governance, and auditable correction — not package quality or regulatory compliance per se. Companion volume: the online book The GxP Statistical Computing Environment.

Keywords

R package validation · large language models · metamorphic testing · mutation testing · computerized system validation · audit trail · GxP

Cite

Jaime Yan. "Human-Governed Validation of R Packages for Regulated Statistical Computing: LLM-Assisted Specifications and Auditable Test Evidence." Preprint (submitted to Pharmaceutical Statistics), 2026.