Free examples and use-cases:   rpact vignettes
rpact: Confirmatory Adaptive Clinical Trial Design and Analysis

Summary

This R Markdown document provides examples that illustrate the usage of R generic functions (short: R generics) with rpact, e.g., as.data.frame or summary.

1 Creating examples of selected rpact result objects

First, load the rpact package

library(rpact)
packageVersion("rpact") # version should be version 3.0 or later
## [1] '3.3.2'

In the following we define different (typical) examples of rpact applications. The results are rpact objects which refer to examples for design specifications, power and sample size calculations, simulation results and the results of a data analysis with defined design and datasets.

designGroupSequential <- getDesignGroupSequential(
    alpha = 0.05, kMax = 4,
    sided = 1, typeOfDesign = "WT", deltaWT = 0.1
)

designFisher <- getDesignFisher(
    kMax = 4, alpha = 0.025,
    informationRates = c(0.2, 0.5, 0.8, 1), alpha0Vec = rep(0.4, 3)
)

designCharacteristics <- getDesignCharacteristics(designGroupSequential)

powerAndASN <- getPowerAndAverageSampleNumber(designGroupSequential, theta = 0.5, nMax = 40)

sampleSizeResults <- getSampleSizeMeans(designGroupSequential)

powerResults <- getPowerMeans(designGroupSequential, maxNumberOfSubjects = 100)

designSet <- getDesignSet(design = designGroupSequential, deltaWT = c(0.3, 0.4))

dataset <- getDataset(
    n1 = c(22, 11, 22, 11),
    n2 = c(22, 13, 22, 13),
    means1 = c(1, 1.1, 1, 1),
    means2 = c(1.4, 1.5, 3, 2.5),
    stDevs1 = c(1, 2, 2, 1.3),
    stDevs2 = c(1, 2, 2, 1.3)
)

analysisResults <- getAnalysisResults(designGroupSequential, dataset)

2 How to use R generic functions with rpact objects

This section describes how the defined objects can be used and displayed. It is important to understand this is the way how typically R objects can be handled with. Particularly, we tried to make the summary() output (except for the technical developer summaries) “ready to use”, e.g., for a design report.

2.1 Get field names of the object

names(designGroupSequential)
##  [1] "kMax"                   "alpha"                  "stages"                
##  [4] "informationRates"       "userAlphaSpending"      "criticalValues"        
##  [7] "stageLevels"            "alphaSpent"             "bindingFutility"       
## [10] "tolerance"              "typeOfDesign"           "beta"                  
## [13] "deltaWT"                "deltaPT1"               "deltaPT0"              
## [16] "futilityBounds"         "gammaA"                 "gammaB"                
## [19] "optimizationCriterion"  "sided"                  "betaSpent"             
## [22] "typeBetaSpending"       "userBetaSpending"       "power"                 
## [25] "twoSidedPower"          "constantBoundsHP"       "betaAdjustment"        
## [28] "delayedInformation"     "decisionCriticalValues" "reversalProbabilities"

2.1.1 Access data of a field

designGroupSequential$criticalValues
## [1] 3.069028 2.325888 1.977663 1.762694
designGroupSequential[["criticalValues"]]
## [1] 3.069028 2.325888 1.977663 1.762694