rpact: Confirmatory Adaptive Clinical Trial Design and Analysis

Summary

This R Markdown document provides many different examples for creating one- and multi-arm analysis result plots with rpact and ggplot2.

1 Preparation and design

First, load the rpact package

library(rpact)
packageVersion("rpact") 
## [1] '3.0.3'

1.1 Create a design

designIN <- getDesignInverseNormal(kMax = 4, alpha = 0.02, 
    futilityBounds = c(-0.5, 0, 0.5),   bindingFutility = FALSE, 
    typeOfDesign = "asKD", gammaA = 1.2,
    informationRates = c(0.15, 0.4, 0.7, 1))

2 Analysis results base

2.1 Analysis results base - means

simpleDataExampleMeans1 <- getDataset(
    n = c(120, 130, 130),
    means = c(0.45, 0.51, 0.45) * 100,
    stDevs = c(1.3, 1.4, 1.2) * 100
)

x <- getAnalysisResults(design = designIN, dataInput = simpleDataExampleMeans1, 
    nPlanned = 130, thetaH0 = 30, thetaH1 = 60, assumedStDev = 100)
## Calculation of final confidence interval performed for kMax = 4 (for kMax > 2, it is theoretically shown that it is valid only if no sample size change was performed)
plot(x, thetaRange = c(10,80)) 

plot(x, type = 2) 

simpleDataExampleMeans2 <- getDataset(
    n1 = c(23, 13, 22, 13),
    n2 = c(22, 11, 22, 11), 
    means1 = c(2.7, 2.5, 4.5, 2.5) * 100,
    means2 = c(1, 1.1, 1.3, 1) * 100,   
    stds1 = c(1.3, 2.4, 2.2, 1.3) * 100,
    stds2 = c(1.2, 2.2, 2.1, 1.3) * 100
)

x <- getAnalysisResults(design = designIN, dataInput = simpleDataExampleMeans2, 
    thetaH0 = 110, equalVariances = TRUE, directionUpper = TRUE, stage = 2)
plot(x, nPlanned = c(20, 30))

plot(x, type = 2)

2.2 Analysis results base - rates

simpleDataExampleRates1 <- getDataset(
    n = c(8, 10, 9, 11), 
    events = c(4, 5, 5, 6)
)

x <- getAnalysisResults(design = designIN, dataInput = simpleDataExampleRates1,
    stage = 3,  thetaH0 = 0.75, normalApproximation = TRUE, 
    directionUpper = FALSE, nPlanned = 10)
## Calculation of final confidence interval performed for kMax = 4 (for kMax > 2, it is theoretically shown that it is valid only if no sample size change was performed)
plot(x)
## Warning: Removed 1 row(s) containing missing values (geom_path).

plot(x, type = 2)

x <- getAnalysisResults(design = designIN, dataInput = simpleDataExampleRates1,
    stage = 3,  thetaH0 = 0.75, normalApproximation = FALSE, 
    directionUpper = FALSE)
plot(x, nPlanned = 20) 
## Warning: Removed 1 row(s) containing missing values (geom_path).

plot(x, type = 2)

simpleDataExampleRates2 <- getDataset(
    n1 = c(17, 23, 22),
    n2 = c(18, 20, 19),
    events1 = c(11, 12, 17),
    events2 = c(5, 10, 7)
)

x <- getAnalysisResults(designIN, simpleDataExampleRates2, thetaH0 = 0, 
    stage = 2, directionUpper = TRUE, normalApproximation = FALSE, 
    pi1 = 0.9, pi2 = 0.3, nPlanned = c(20, 20))
## Repeated confidence intervals will be calculated under the normal approximation
plot(x, piTreatmentRange = c(0.2,0.8))

plot(x, type = 2)

2.3 Analysis results base - survival

simpleDataExampleSurvival <- getDataset(
    overallEvents = c(8, 15, 29),
    overallAllocationRatios = c(1, 1, 1),
    overallLogRanks = c(1.52, 1.38, 2.9)
)

x <- getAnalysisResults(designIN, simpleDataExampleSurvival, 
    directionUpper = TRUE, nPlanned = 20)
## Calculation of final confidence interval performed for kMax = 4 (for kMax > 2, it is theoretically shown that it is valid only if no sample size change was performed)
plot(x, thetaRange = c(1,3))