rpact: Confirmatory Adaptive Clinical Trial Design and Analysis

This R markdown file provides examples for designing trials with continuous endpoints using rpact. These examples are not intended to replace the official rpact documentation and help pages but rather to supplement them. They also only cover a selection of all rpact features.

2 Sample size calculation for a superiority trial without interim analyses

Sample size for a trial with continuous endpoints can be calculated using the function getSampleSizeMeans. This function is fully document in the relevant help page (?getSampleSizeMeans). Some examples are provided below.

getSampleSizeMeans requires that the mean difference between the two arms is larger under the alternative than under the null hypothesis. For superiority trials, this implies, that rpact requires that the targeted mean difference is >0 under the alternative hypothesis. If this is not the case, the function gives an error. To circumvent this and power for a negative mean difference, one can simply switch the two arms (leading to a positive mean difference) as the situation is perfectly symmetric.

By default, getSampleSizeMeans tests hypotheses about the mean difference. rpact also supports testing hypotheses about mean ratios if the argument meanRatio is set to TRUE but this will not be discussed further in this document.

By default, rpact uses sample size formulas for the \(t\)-test, i.e., it assumes that the standard deviation in the two groups is equal but unknown and estimated from the data. If sample size calculations for the \(Z\)-test are desired, one can set the argument normalApproximation to TRUE but this is usually not recommended.

## Design plan parameters and output for means:
## 
## Design parameters:
##   Significance level                           : 0.0500 
##   Type II error rate                           : 0.2 
##   Two-sided power                              : FALSE 
##   Test                                         : two-sided 
## 
## User defined parameters:
##   Alternatives                                 : 10 
##   Standard deviation                           : 24 
## 
## Default parameters:
##   Normal approximation                         : FALSE 
##   Mean ratio                                   : FALSE 
##   Theta H0                                     : 0 
##   Treatment groups                             : 2 
##   Planned allocation ratio                     : 1 
## 
## Sample size and output:
##   Number of subjects fixed                     : 182.8 
##   Number of subjects fixed (1)                 : 91.4 
##   Number of subjects fixed (2)                 : 91.4 
##   Lower critical values (effect scale)         : -6.959 
##   Upper critical values (effect scale)         : 6.959 
##   Local two-sided significance levels          : 0.0500 
## 
## Legend:
##   (i): values of treatment arm i

As per the output above, the required total sample size for the trial is 183 and the critical value corresponds to a minimal detectable mean difference of approximately 6.96.

Unequal randomization between the treatment groups can be defind with allocationRatioPlanned, for example,

## Design plan parameters and output for means:
## 
## Design parameters:
##   Significance level                           : 0.0500 
##   Type II error rate                           : 0.2 
##   Two-sided power                              : FALSE 
##   Test                                         : two-sided 
## 
## User defined parameters:
##   Alternatives                                 : 10 
##   Standard deviation                           : 24 
##   Planned allocation ratio                     : 2 
## 
## Default parameters:
##   Normal approximation                         : FALSE 
##   Mean ratio                                   : FALSE 
##   Theta H0                                     : 0 
##   Treatment groups                             : 2 
## 
## Sample size and output:
##   Number of subjects fixed                     : 205.4 
##   Number of subjects fixed (1)                 : 136.9 
##   Number of subjects fixed (2)                 : 68.5 
##   Lower critical values (effect scale)         : -6.963 
##   Upper critical values (effect scale)         : 6.963 
##   Local two-sided significance levels          : 0.0500 
## 
## Legend:
##   (i): values of treatment arm i

Power for a given sample size can be calculated using the function getPowerMeans which has the same arguments as getSampleSizeMeans except that the maximum total sample is given (maxNumberOfSubjects) instead of the type II error (beta).

## Design plan parameters and output for means:
## 
## Design parameters:
##   Significance level                           : 0.0500 
##   Test                                         : two-sided 
## 
## User defined parameters:
##   Alternatives                                 : 12 
##   Standard deviation                           : 24 
##   Planned allocation ratio                     : 2 
##   Direction upper                              : NA 
##   Maximum number of subjects                   : 206.0 
## 
## Default parameters:
##   Normal approximation                         : FALSE 
##   Mean ratio                                   : FALSE 
##   Theta H0                                     : 0 
##   Treatment groups                             : 2 
## 
## Sample size and output:
##   Number of subjects fixed                     : 206.0 
##   Number of subjects fixed (1)                 : 137.3 
##   Number of subjects fixed (2)                 : 68.7 
##   Effect                                       : 12 
##   Overall reject                               : 0.92 
##   Lower critical values (effect scale)         : -6.952 
##   Upper critical values (effect scale)         : 6.952 
##   Local two-sided significance levels          : 0.0500 
## 
## Legend:
##   (i): values of treatment arm i

The calculated power is provided in the output as “Overall reject” and is 0.92 for the example alternative = 12.

getPowerMeans (as well as getSampleSizeMeans) can also be called with a vector argument for the mean difference under the alternative H1 (alternative). This is illustrated below via a plot of power depending on these values. For examples of all available plots, see the R markdown file How to create admirable plots with rpact.

3 Sample size calculation for a non-inferiority trial without interim analyses

Sample size calculation proceeds in the same fashion as for superiority trials except that the role of the null and the alternative hypothesis are reversed and the test is always one-sided. In this case, the non-inferiority margin \(\Delta\) corresponds to the treatment effect under the null hypothesis (thetaH0) which one aims to reject.

## Design plan parameters and output for means:
## 
## Design parameters:
##   Significance level                           : 0.0250 
##   Type II error rate                           : 0.2 
##   Test                                         : one-sided 
## 
## User defined parameters:
##   Theta H0                                     : -12 
##   Alternatives                                 : 0 
##   Standard deviation                           : 14 
## 
## Default parameters:
##   Normal approximation                         : FALSE 
##   Mean ratio                                   : FALSE 
##   Treatment groups                             : 2 
##   Planned allocation ratio                     : 1 
## 
## Sample size and output:
##   Number of subjects fixed                     : 44.7 
##   Number of subjects fixed (1)                 : 22.4 
##   Number of subjects fixed (2)                 : 22.4 
##   Critical values (effect scale)               : -3.795 
##   Local one-sided significance levels          : 0.0250 
## 
## Legend:
##   (i): values of treatment arm i

4 Sample size calculation for group-sequential designs

Sample size calculation for a group-sequential trials is performed in two steps:

  1. Define the (abstract) group-sequential design using the function getDesignGroupSequential. For details regarding this step, see the R markdown file “Defining group-sequential boundaries with rpact”.
  2. Calculate sample size for the continuous endpoint by feeding the abstract design into the function getSampleSizeMeans.

In general, rpact supports both one-sided and two-sided group-sequential designs. However, if futility boundaries are specified, only one-sided tests are permitted. For simplicity, it is often preferred to use one-sided tests for group-sequntial designs (typically with \(\alpha=0.025\)).

R code for a simple example is provided below:

## Design plan parameters and output for means:
## 
## Design parameters:
##   Significance level                           : 0.0250 
##   Type II error rate                           : 0.2 
##   Test                                         : one-sided 
## 
## User defined parameters:
##   Alternatives                                 : 10 
##   Standard deviation                           : 24 
##   Planned allocation ratio                     : 2 
## 
## Default parameters:
##   Normal approximation                         : FALSE 
##   Mean ratio                                   : FALSE 
##   Theta H0                                     : 0 
##   Treatment groups                             : 2 
## 
## Sample size and output:
##   Information rates [1]                        : 0.600 
##   Information rates [2]                        : 1.000 
##   Maximum number of subjects                   : 207.1 
##   Maximum number of subjects (1)               : 138.1 
##   Maximum number of subjects (2)               : 69.0 
##   Number of subjects [1]                       : 124.3 
##   Number of subjects [2]                       : 207.1 
##   Number of subjects (1) [1]                   : 82.9 
##   Number of subjects (1) [2]                   : 138.1 
##   Number of subjects (2) [1]                   : 41.4 
##   Number of subjects (2) [2]                   : 69.0 
##   Expected number of subjects under H0         : 206.8 
##   Expected number of subjects under H0/H1      : 202.4 
##   Expected number of subjects under H1         : 181.3 
##   Reject per stage [1]                         : 0.312 
##   Reject per stage [2]                         : 0.488 
##   Early stop                                   : 0.312 
##   Critical values (effect scale) [1]           : 12.187 
##   Critical values (effect scale) [2]           : 7.008 
##   Local one-sided significance levels [1]      : 0.003808 
##   Local one-sided significance levels [2]      : 0.023798 
## 
## Legend:
##   (i): values of treatment arm i
##   [k]: values at stage k

System: rpact 2.0.3, R version 3.5.3 (2019-03-11), platform: x86_64-w64-mingw32

To cite package ‘rpact’ in publications use:

Gernot Wassmer and Friedrich Pahlke (2019). rpact: Confirmatory Adaptive Clinical Trial Design and Analysis. R package version 2.0.3. https://CRAN.R-project.org/package=rpact

 

Creative Commons License
This work by Dietmar Volz, Marcel Wolbers, Gernot Wassmer and Friedrich Pahlke is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.