← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / OpenAI4S / skills / bioskills / bio-workflows-clinical-trial-pipeline / references / usage-guide.md

Clinical Trial Analysis Pipeline - Usage Guide

Overview

End-to-end workflow for analyzing clinical trial data following CONSORT 2025, ICH E9(R1) estimand framework, and FDA 2023 covariate adjustment guidance. Takes CDISC SDTM/ADaM domain files through data preparation, ICH E9(R1) estimand specification, primary analysis (logistic regression with marginal vs conditional reporting, MMRM for continuous longitudinal, Cox/RMST for time-to-event), modern categorical testing, subgroup analysis with HTE methods, missing-data sensitivity (MMRM under MAR, reference-based MI, Permutt tipping point), graphical multiplicity (Bretz-Maurer), and regulatory-compliant reporting.

Prerequisites

pip install statsmodels scipy tableone pyreadstat pandas numpy matplotlib scikit-learn lifelines scikit-survival

Optional for rare events:

pip install firthmodels

R is strongly recommended for confirmatory regulatory work (MMRM with Kenward-Roger; reference-based MI; graphical multiplicity):

install.packages(c('mmrm', 'rbmi', 'gMCP', 'rpact', 'gsDesign', 'survival', 'survRM2', 'RBesT', 'BOIN'))

Quick Start

Tell your AI agent what you want to do: - "Analyze my clinical trial data from start to finish with ICH E9(R1) estimand framework" - "I have CDISC .xpt files for a vaccine trial -- run the full analysis with CONSORT 2025 reporting" - "Perform a complete statistical analysis of treatment vs placebo with marginal RD primary per FDA 2023" - "Run logistic regression, subgroup analysis with causal forests, and generate Table 1 for my trial data" - "Continuous longitudinal endpoint: run MMRM with Kenward-Roger as primary, J2R reference-based MI as MNAR sensitivity"

Example Prompts

Full Pipeline

"I have DM, AE, and EX domain files from a BCG vaccination trial. Define the ICH E9(R1) estimand first (5 attributes including ICE strategy). Create a subject-level dataset, run logistic regression on COVID-19 severity with marginal RD via g-computation per FDA 2023 (conditional OR as supportive), test associations with Boschloo's exact, analyze subgroups by patient load with graphical multiplicity via gMCP, and generate a Table 1 per CONSORT 2025."

"Analyze my clinical trial data end to end. The primary endpoint is binary adverse event. I need: marginal RD via g-computation, conditional OR as supportive, subgroup forest plot with INTERACTION p-values (not per-subgroup comparison), Permutt tipping-point sensitivity analysis, and CONSORT 2025 flow diagram."

Continuous longitudinal endpoint

"Continuous primary endpoint is change in HbA1c at week 24. Pre-specify ICH E9(R1) hypothetical estimand for treatment discontinuation ICE. Fit MMRM with UN+Kenward-Roger via R mmrm. Sensitivity: J2R reference-based MI via R rbmi reporting BOTH Cro information-anchored variance AND Wolbers frequentist (CMI+jackknife)."

Time-to-event primary endpoint

"Primary endpoint is OS. Run stratified log-rank + Cox PH with Therneau-Grambsch diagnostic. If PH violated, switch to RMST at pre-specified tau=36 months. If competing risks (non-cardiac death), cause-specific Cox for both events + Aalen-Johansen CIF."

Data Preparation

"Load my CDISC SDTM files and create a subject-level analysis dataset. Merge demographics with adverse events, aggregate to one row per subject with maximum severity, code the treatment variable, and tabulate DS (Disposition) domain for differential dropout patterns by arm (informs missing-data strategy)."

Primary Analysis

"Run logistic regression on my prepared clinical dataset with treatment as the primary predictor, adjusting for age, sex, and randomisation strata. Extract BOTH conditional OR (model-fit, supportive) and marginal RD via g-computation with a percentile bootstrap CI per FDA 2023."

Subgroup Analysis

"Test whether the treatment effect varies across pre-specified subgroups via INTERACTION terms in single model (NOT per-subgroup p-comparisons). For continuous biomarker subgroups, use STEPP. Generate forest plot. Apply graphical multiplicity allocation via gMCP, allocating (for example) 20% of alpha to the subgroup family."

Reporting

"Generate Table 1 of baseline characteristics by arm with SMD (NOT p-values per Senn 1994 incoherence). Run missing-data sensitivity per CONSORT 2025 item 21c. Provide ICH E9(R1) estimand statement (5 attributes) in CSR appendix. Format harms per CONSORT 2025 item 15."

What the Agent Will Do

  1. Pre-specify ICH E9(R1) estimand (5 attributes including ICE strategy) BEFORE any analysis
  2. Load CDISC SDTM/ADaM files (.xpt or .csv); convert ADTTE CNSR convention if needed
  3. Tabulate DS (Disposition) domain dropout patterns by arm (informs missing-data strategy)
  4. Aggregate event-level data to subject level; merge domains; verify USUBJID uniqueness
  5. Generate Table 1 with SMD (NOT p-values)
  6. Fit logistic regression with explicit reference category; report marginal RD via g-computation per FDA 2023 as primary
  7. Run Boschloo (preferred over Fisher) for small 2x2 categorical tests; Pearson chi-square for adequate counts
  8. Test subgroup interactions in single model; apply graphical multiplicity via gMCP
  9. For continuous longitudinal: MMRM with Kenward-Roger as primary; reference-based MI as MNAR sensitivity
  10. For time-to-event: Cox + cox.zph diagnostic; switch to RMST under PH violation
  11. Permutt tipping-point sensitivity in residual SD units
  12. Format reporting per CONSORT 2025 30-item checklist

Tips