Designing Clinical Trials in R with rpact and crmPack

PharmaSUG SDE, Tokyo

Daniel Sabanés Bové, Friedrich Pahlke, Gernot Wassmer

RCONIS

April 7, 2025

日本に戻って来れてうれしい 🗾

Me presenting my poster in Kyoto in 2012

International Society for Bayesian Analysis (ISBA) conference My poster abstract

Designing clinical trials in R

Task 📋

  • Statistician needs to help with designing a clinical trial
  • Evaluate different trial design options (fixed sample, group sequential, adaptive)
  • Often starts with the clinician’s question “How many patients do we need?”
  • Need to calculate operating characteristics for the different trial designs (power, type I error, expected sample size, etc.)
  • Need to assess adaptive designing strategies, e.g., sample size reassessment, treatment arm or population selection

Ecosystem in R 🌏

Objectives of my talk 🎯

  • Raise awareness of the open source R package
    rpact for confirmatory clinical trial designs
    • Show RPACT Cloud as alternative to traditional proprietary software for clinical trial design
  • Raise awareness of the open source R package
    crmPack for dose escalation trial designs
  • Inform about the options for professional support
  • Get RCONIS known as point of contact in Asia

rpact

Overview 📦

  • Comprehensive validated R package implementing methodology described in Wassmer and Brannath (2016)
    (2nd edition coming in 2025 with R examples!)
  • Enables the design of traditional and confirmatory adaptive group sequential designs
  • Provides interim data analysis including early efficacy stopping and futility analyses
  • Enables sample-size reassessment with different strategies
  • Enables treatment arm selection in multi-stage multi-arm (MAMS) designs
  • Enables subset selection in population enrichment designs
  • Provides a comprehensive and reliable sample size calculator

Developed by RPACT 🏢

  • RPACT company founded in 2017 by Gernot Wassmer and Friedrich Pahlke
  • Idea: open source development with help of “crowd funding”
  • Currently supported by 21 companies
  • \(>\) 80 presentations and training courses since 2018, e.g., FDA in March 2022
  • 29 vignettes based on Quarto and published on rpact.org/vignettes
  • 28 releases on CRAN since 2018
  • August 2024: New joint venture RCONIS (Daniel Sabanés Bové, Carrie Li)

RCONIS Team

RCONIS Idea 💡

  • Grow RPACT company to offer a wider range of services
  • Strengthen maintainer team for the rpact package
  • Team growth combined with scope growth
  • Statistical consulting and engineering services:
    Research Consulting and Innovative Solutions
  • Legal entity still in the making, currently a collaboration between RPACT GbR (rpact.com) and inferential.biostatistics GmbH (inferential.bio)
  • Website: rconis.com

But now back to rpact!

Trial Designs 🔬

  • Fixed sample designs:
    • continuous, binary, count, survival outcomes
  • Group sequential designs:
    • efficacy interim analyses, futility stopping, alpha-spending functions
  • Adaptive designs:
    • Inverse normal and Fisher’s combination test, conditional error rate principle
    • Provides adjusted confidence intervals and bias corrected estimates
    • Multi-arm multi-stage (MAMS) and enrichment designs, sample size reassessment

Easy to understand R commands:

getDesignGroupSequential()
getDesignInverseNormal()
getDesignFisher()
getDesignConditionalDunnett()

Sample Size and Power Calculation 💻

Sample size and power can be calulcated for testing:

  • means (continuous endpoint)
  • proportions (binary endpoint)
  • hazards (survival endpoint)
    • Note: flexible recruitment and survival time options
  • rates (count endpoint)

Easy to understand R commands:

getSampleSize[Means / Rates / Survival / Counts]()
getPower[Means / Rates / Survival / Counts]()

Example: Sample Size Calculation 🧮

library(rpact)

# Define the design.
getDesignGroupSequential(
    typeOfDesign = "asOF",
    futilityBounds = c(0, 0)
) |>
    # Perform sample size calculation.
    getSampleSizeMeans(
        alternative = 2,
        stDev = 5
    ) |>
    # Obtain summary.
    summary()

Sample size calculation for a continuous endpoint

Sequential analysis with a maximum of 3 looks (group sequential design), one-sided overall significance level 2.5%, power 80%. The results were calculated for a two-sample t-test, H0: mu(1) - mu(2) = 0, H1: effect = 2, standard deviation = 5.

Stage 1 2 3
Planned information rate 33.3% 66.7% 100%
Cumulative alpha spent 0.0001 0.0060 0.0250
Stage levels (one-sided) 0.0001 0.0060 0.0231
Efficacy boundary (z-value scale) 3.710 2.511 1.993
Futility boundary (z-value scale) 0 0
Efficacy boundary (t) 4.690 2.152 1.384
Futility boundary (t) 0 0
Cumulative power 0.0204 0.4371 0.8000
Number of subjects 69.9 139.9 209.8
Expected number of subjects under H1 170.9
Overall exit probability (under H0) 0.5001 0.1309
Overall exit probability (under H1) 0.0684 0.4202
Exit probability for efficacy (under H0) 0.0001 0.0059
Exit probability for efficacy (under H1) 0.0204 0.4167
Exit probability for futility (under H0) 0.5000 0.1250
Exit probability for futility (under H1) 0.0480 0.0035

Legend:

  • (t): treatment effect scale

Adaptive Analysis 📈

  • Calculate adjusted point estimates and confidence intervals
  • Some highlights:
    • Automatic boundary recalculations during the trial for analysis with alpha spending approach, including under- and over-running
    • Adaptive analysis tools for multi-arm trials
    • Adaptive analysis tools for enrichment designs

Easy to understand R commands:

getStageResults()
getRepeatedConfidenceIntervals()
getAnalysisResults()

Simulation Tool 🧪

Obtain operating characteristics of different designs:

  • Assessment of adaptive sample size recalculation strategies
  • Assessment of treatment selection strategies in multi-arm trials
  • Assessment of population selection strategies in enrichment designs

Easy to understand R commands:

getSimulation[MultiArm / Enrichment][Means / Rates / Survival / Counts]()

Example:

getSimulationMeans()
getSimulationMultiArmMeans()
getSimulationEnrichmentMeans()

Package Validation Concept ✔️

Why is rpact a reliable R package?

  • Formal validation inspired by “GAMP 5” principles
  • As few dependencies as possible:
    • Imports: Rcpp
    • Suggests: testthat, ggplot2, R6
  • High test coverage:
  • testPackage(): installation qualification on a client computer or company server (with professional support, more later)

RPACT Cloud

RPACT Cloud ☁️

  • Graphical user interface
  • Web based usage without local installation on nearly any device ☁️
  • Provides an easy entry to rpact
  • Starting point for your R Markdown or Quarto reports
  • Helpful to learn/demonstrate the usage of rpact in a user friendly and intuitive way
  • Online available at cloud.rpact.com

Start Page

Design

Reporting

Export

Design Comparison

Professional Support Option 🤝

  • Service Level Agreement (SLA) with RPACT
  • Be part of the “RPACT User Group”
    \(\rightarrow\) yearly customer meetings
  • Get technical software support for written support requests
  • Get company specific training
  • Get company specific software validation documentation for each rpact release on CRAN
  • Get access to the members area at www.rpact.com
  • Make an rpact installation qualification on each company computer with your personal testPackage() token and secret
  • Determine the direction of rpact future development activities
  • Optional support for health authority interactions
  • Optional consultation to support specific clinical trials

crmPack

Overview 📦

  • Specialized R package for dose escalation trials
  • Initial CRAN release in 2016, publication by Sabanés Bové et al. (2019)
  • Higher flexibility compared to other software, thanks to its modular design
  • Easy extensibility and adoption of new designs
  • Produces visual and numeric outputs for easy interpretation
  • Facilitates simulations to assess the performance under various scenarios

Large group of contributors 🏢

  • Clara Beck (Bayer)
  • Oliver Boix (Bayer)
  • Prerana Chandratre (Bayer)
  • Robert Adams (Bayer)
  • Dimitris Kontos (ClinBAY/Bayer)
  • Jiawen Zhu (Genentech)
  • Ziwei Liao (Genentech)
  • Daniel Sabanés Bové (Roche/RCONIS)
  • John Kirkpatrick (Roche/Astellas)
  • Giuseppe Palermo (Roche)
  • Guanya Peng (Roche)
  • Doug Kelkhoff (Roche)
  • Wojciech Wojciak (Roche)
  • Marlene Schulte-Goebel (Merck)
  • Burak Kuersad Guenhan (Merck)
  • Wai Yin Yeung (University of Lancaster/Roche)
  • Thomas Jaki (University of Lancaster/Cambridge/Regensburg)

Framework

crmPack provides a highly flexible framework for the design and analysis of dose escalation trials. This schematic illustrates the framework’s key components and their interactions:

crmPack Framework

Example: Dose Escalation Design 💊

# remotes::install_github("openpharma/crmPack")
library(crmPack)

empty_data <- Data(doseGrid = c(1, 3, 5, 10, 15, 20, 25, 40, 50, 80, 100))

# Initialize the CRM model.
my_model <- LogisticLogNormal(
    mean = c(-0.85, 1),
    cov = matrix(c(1, -0.5, -0.5, 1), nrow = 2),
    ref_dose = 56
)

# Choose the rule for selecting the next dose.
my_next_best <- NextBestNCRM(
    target = c(0.2, 0.35),
    overdose = c(0.35, 1),
    max_overdose_prob = 0.25
)

# Choose the rule for the cohort-size.
my_size1 <- CohortSizeRange(
    intervals = c(0, 30),
    cohort_size = c(1, 3)
)
my_size2 <- CohortSizeDLT(
    intervals = c(0, 1),
    cohort_size = c(1, 3)
)
my_size <- maxSize(my_size1, my_size2)

# Choose the rule for stopping.
my_stopping1 <- StoppingMinCohorts(nCohorts = 3)
my_stopping2 <- StoppingTargetProb(
    target = c(0.2, 0.35),
    prob = 0.5
)
my_stopping3 <- StoppingMinPatients(nPatients = 20)
my_stopping <- (my_stopping1 & my_stopping2) | my_stopping3

# Choose the rule for dose increments.
my_increments <- IncrementsRelative(
    intervals = c(0, 20),
    increments = c(1, 0.33)
)

# Initialize the design.
design <- Design(
    model = my_model,
    nextBest = my_next_best,
    stopping = my_stopping,
    increments = my_increments,
    cohort_size = my_size,
    data = empty_data,
    startingDose = 3
)

Current Status

The current development version of crmPack (Sabanés Bové et al. 2024) has the following features:

  • Model-based designs (CRM), rule-based designs (3+3)
  • Binary, time-to-event, dual efficacy/safety, ordinal outcomes
  • 15 different models
  • 14 different recommendation options
  • 19 different stopping rules
  • 9 cohort size rules
  • 9 increment rules
  • Reporting functionality (using knitr)
  • 9 vignettes (documentation)

Professional Support Option 🤝

  • Service Level Agreement (SLA) with RPACT
  • Get technical software support for written support requests
  • Get company specific training
  • Get company specific software validation documentation for each crmPack release on CRAN
  • Make a crmPack installation qualification on each company computer
  • Determine the direction of crmPack future development activities
  • Optional support for health authority interactions
  • Optional consultation to support specific clinical trials

何かご質問はございますか ❓

Slides and contact 📫

References

Emerson, Scott. 2000. S+SeqTrial Technical Overview. Insightful Corporation. https://www.msi.co.jp/splus/addon/pdf/seqtech.pdf.
Sabanés Bové, Daniel, Wai Yin Yeung, Giuseppe Palermo, and Thomas Jaki. 2019. “Model-Based Dose Escalation Designs in R with crmPack.” Journal of Statistical Software 89 (10): 1–22. https://doi.org/10.18637/jss.v089.i10.
Sabanés Bové, Daniel, Wai Yin Yeung, Burak Kuersad Guenhan, Giuseppe Palermo, Thomas Jaki, Jiawen Zhu, Ziwei Liao, et al. 2024. crmPack: Object-Oriented Implementation of CRM Designs. https://github.com/openpharma/crmPack.
Wassmer, Gernot, and Werner Brannath. 2016. Group Sequential and Confirmatory Adaptive Designs in Clinical Trials. Springer. https://link.springer.com/book/10.1007/978-3-319-32562-0.
Wassmer, Gernot, and Friedrich Pahlke. 2024. rpact: Confirmatory Adaptive Clinical Trial Design and Analysis. https://CRAN.R-project.org/package=rpact.