Title: | Phase II Single-Arm Two-Stage Designs with Time-to-Event Outcomes |
Version: | 1.2.1 |
Description: | Two-stage design for single-arm phase II trials with time-to-event endpoints (e.g., clinical trials on immunotherapies among cancer patients) can be calculated using this package. Two notable advantages of the package: 1) It provides flexible choices from three design methods (optimal, minmax, and admissible), and 2) the power of the design is more accurately calculated using the exact variance in the one-sample log-rank test. The package can be used for 1) planning the sample sizes and other design parameters, and 2) conducting the interim and final analyses for the Go/No-go decisions. More details about the design method can be found in: Wu, J, Chen L, Wei J, Weiss H, Chauhan A. (2020). <doi:10.1002/pst.1983>. |
NeedsCompilation: | no |
Encoding: | UTF-8 |
Repository: | CRAN |
RoxygenNote: | 7.2.1 |
Imports: | survival, utils, flexsurv, IPDfromKM |
Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
VignetteBuilder: | knitr |
Config/testthat/edition: | 3 |
License: | GPL (≥ 3) |
Depends: | R (≥ 3.5.0) |
Packaged: | 2023-10-09 21:14:24 UTC; xyuan86 |
Author: | Xiaomeng Yuan [aut, cre], Haitao Pan [aut], Jianrong Wu [aut] |
Maintainer: | Xiaomeng Yuan <xiaomeng.yuan@stjude.org> |
Date/Publication: | 2023-10-09 22:30:11 UTC |
Fit Historical Survival Data Assuming the Failure Time Follows a Weibull Distribution
Description
The function fits parametric models for the time-to-event data with the underlying distribution of the failure time assumed to be Weibull.
Usage
FitDat(data)
Arguments
data |
a historical survival data sample, has to contain two variables
'Time' and 'Cens': |
Value
fit.Weibull the fitted model assuming a Weibull distribution.
AIC the AIC value from the fitted model.
parameter.estimates the estimated parameters from the fitted
model.
References
Wang, M., Rule, S., Zinzani, P. L., Goy, A., Casasnovas, O., Smith, S. D.,..., Robak, T. (2018). Acalabrutinib in relapsed or refractory mantle cell lymphoma (ACE-LY-004): a single-arm, multicentre, phase 2 trial. The Lancet, 391(10121), 659–667. https://doi.org/10.1016/s0140-6736(17)33108-2
Examples
library(IPDfromKM)
# a sample dataset that we already extracted from Wang et al, 2018.
df<- read.csv(system.file("extdata", "df.csv", package = "OneArm2stage"))
# risk time points
trisk <- c(0,2,4,6,8,10,12,14,16,18,20,22,24)
# number of patients at risk at each risk time point
nrisk.radio <- c(124,120,115,110,107,104,103,95,46,18,11,8,0)
# Preprocess the raw coordinates into an proper format for reconstruct IPD
pre_radio <- preprocess(dat=df, trisk=trisk,
nrisk=nrisk.radio,totalpts=NULL,maxy=100)
#Reconstruct IPD
est_radio <- getIPD(prep=pre_radio,armID=0,tot.events=NULL)
# shift the IPD data into the proper format for 'FitDat()'
ipd <- est_radio$IPD
dat3 <- as.data.frame(cbind(rep(0, nrow(ipd)),ipd$time, ipd$status))
colnames(dat3) <- c("Entry", "Time", "Cens")
# use FitDat function to fit the historical dat
modelSelect <- FitDat(dat3)
modelSelect$AIC
# Weibull
# 301.7776
# check the estimated parameters from the modeling results
modelSelect$parameter.estimates
# $Weibull
# shape scale
# 0.1133671 3.9939753
Generate Survival Data with unrestricted Follow-Up
Description
Generate survival data with restricted follow-up Using Weibull Distribution.
Usage
GenDat_KJ(shape, S_fixed, x_fixed, rate, tf, t1, n, seed)
Arguments
shape |
shape parameter for WB distributions. |
S_fixed |
survival probability at the fixed time point x_fixed. |
x_fixed |
a fixed time point where the survival probability is known. |
rate |
a constant accrual rate. |
tf |
the follow-up time. |
t1 |
the interim analysis time. |
n |
sample size. |
seed |
seed used for the random sample generation. |
Value
Two dataframes: data (the full data for final analysis) and data_t1 (the data for interim analysis), both containing the following 4 variables:
Entry time when each patient enters the trial, assumed to be uniform from 0 to ta with ta as the time when enrollment ends.
time the time under observation during entire trial (in data) or before t1 (in data_t1) for each patient.
status the status indicator of patients (event = 1, censored = 0), which can be different between data and data_t1.
Total the sum of Entry and time.
Generate Survival Data with Restricted Follow-Up
Description
Generate survival data with restricted follow-up from Weibull distribution.
Usage
GenDat_rKJ(shape, S_fixed, x_fixed, rate, t1, x, n, seed)
Arguments
shape |
shape parameter for WB distribution. |
S_fixed |
survival probability at the fixed time point x_fixed. |
x_fixed |
a fixed time point where the survival probability is known. |
rate |
a constant accrual rate. |
t1 |
the time when interim analysis happens. |
x |
the restricted follow-up time period, during which patients are monitored. |
n |
sample size. |
seed |
seed used for the random sample generation. |
Value
Two dataframes: data (the full data for final analysis) and data_t1 (the data for interim analysis), both containing the following 4 variables:
Entry time when each patient enters the trial, assumed to be uniform from 0 to ta with ta as the time when enrollment ends.
time the time under observation during entire trial (in data) or before t1 (in data_t1) for each patient.
status the status indicator of patients (event = 1, censored = 0), which can be different between data and data_t1.
Total the sum of Entry and time.
Conduct the Interim or Final Analysis Using the One-Sample Log-Rank Test for Two-Stage TTE Trials
Description
Performs the one-sample log-rank test (OSLR) for the time-to-event data from two-stage Phase II clinical trials assuming the failure time follows a Weibull distribution. This can be used for designs with either unrestricted or restricted follow-up .
Usage
LRT(shape, S0, x0, data)
Arguments
shape |
shape parameter for the Weibull distribution. |
S0 |
the survival probability at a fixed time point x0 under the null hypothesis. |
x0 |
a fixed time point when the survival probability is S0 under null. |
data |
the time-to-event data for either the interim or final analysis
from a two-stage survival trial, contains 2 variables: |
Value
z the OSLR test statistic for the interim or final analysis,
depending on data used.
O the observed number of events.
E the expected number of events.
References
Wu, J, Chen L, Wei J, Weiss H, Chauhan A. (2020). Two-stage phase II survival trial design. Pharmaceutical Statistics. 2020;19:214-229. https://doi.org/10.1002/pst.1983
Examples
dat<- read.csv(system.file("extdata", "kj1_final.csv", package = "OneArm2stage"))
LRT(shape=1, S0=0.62, x0=2, data=dat)
# O E Z
# 18.0000 16.3598 -0.4055
Calculate Empirical Power by Simulation for Two-Stage Designs Using One-Sample Log-Rank Test
Description
Sim() can be used to calculate the empirical power and type-I error by simulation given the design parameters obtained from the two-stage designs using phase2.TTE().
Usage
Sim(
shape,
S0,
S1,
x0,
tf,
rate,
t1,
c1,
c,
n1,
n,
N,
restricted = 0,
seed = 123
)
Arguments
shape |
shape parameter of the baseline hazard function assuming Weibull distribution. |
S0 |
survival probability at a fixed time point x0 under the null hypothesis. |
S1 |
survival probability at a fixed time point x0 under the alternative hypothesis. |
x0 |
a fixed time point where the survival probabilities are known for both null and alternative hypotheses. |
tf |
the follow-up time, the time period from the entry of the last patient to the end of the trial. |
rate |
a constant accrual rate. |
t1 |
the interim analysis time as given by the two-stage design. |
c1 |
the critical value for the interim analysis as given by the two-stage design. |
c |
the critical value for the final analysis as given by the two-stage design. |
n1 |
the required sample size for the interim analysis as given by the two-stage design. |
n |
the required total sample size for the entire trial as given by the two-stage design. |
N |
number of trials in the simulation. |
restricted |
if restricted = 0 (default value), unrestricted follow-up is used. If restricted = 1 or any other values, restricted follow-up is used. |
seed |
seed for random number generation. |
Value
a numeric value that is either the empirical power (when S1=S0^hr) or the type I-error (when S1=S0).
Examples
# calculate empirical power and type I error given design parameters
Sim(shape=1, S0=0.62, S1=0.62^(0.467), x0=2, tf=2, rate=5, t1=3.0593,
c1=-0.302, c=1.6135, n1=16, n=26, N=10000, seed=5868)
# empirical power
# 0.813
Sim(shape=1, S0=0.62, S1=0.62, x0=2, tf=2, rate=5, t1=3.0593,
c1=-0.302, c=1.6135, n1=16, n=26, N=10000, seed=5868)
# empirical type-I error
# 0.037
Two-Stage Designs with TTE Outcomes Using the One-Sample Log-Rank Test
Description
phase2.TTE() provides the clinical trial design solutions for two-stage trials with time-to-event outcomes based on the one-sample log-rank (OSLR) test. It calculates the design parameters (e.g., t1, n1, n, c1, c) using optimal, minmax and admissible methods.
Usage
phase2.TTE(
shape,
S0,
x0,
hr,
tf,
rate,
alpha,
beta,
prStop = 0,
q_value = 0.5,
dfc1 = 0.001,
dfc2 = 0.001,
dfc3 = 0.001,
maxEn = 10000,
range = 1,
t1_p1 = 0.2,
t1_p2 = 1.2,
c1_p = 0.25,
nbpt_p = 11,
pascote_p = 1.26,
restricted = 0
)
Arguments
shape |
shape parameter for the baseline hazard function assuming that the failure time follows a Weibull distribution. |
S0 |
survival probability at the fixed time point x0 under the null hypothesis (i.e, H0). |
x0 |
a fixed time point where the survival probability is S0 under the null. |
hr |
hazard ratio, hr < 1. s1=s0^hr, where s1 is the survival probability under the alternative hypothesis (i.e., HA) and s0 is that under H0. |
tf |
the follow-up time (restricted or unrestricted), the time period from the entry of the last patient to the end of the trial. |
rate |
a constant accrual rate. Please consider use a reasonable rate value. If the rate is too small, the function might throw an error. |
alpha |
type I error. |
beta |
type II error. |
prStop |
the lower limit of the early stopping probability under H0, with default=0. |
q_value |
the relative importance between the maximum sample size (n) and the expected sample size under H0 (ES) when deriving the design based on the admissible method. The default is 0.5 and the range is (0, 1). The smaller q_value is, the more importance is given to ES. The greater it is, the more importance is given to n. |
dfc1 |
the value defines the stopping criterion of the optimization process in the minmax method with smaller values lead to more iterations, default=0.001. Change is not recommended. |
dfc2 |
the value defines the stopping criterion of the optimization process in the optimal method, smaller values lead to more iterations, default=0.001. Change is not recommended. |
dfc3 |
the value defines the stopping criterion of the optimization process in the admissible method, smaller values lead to more iterations, default=0.001. Change is not recommended. |
maxEn |
the maximum of the expected sample size under null, default= 10000. Change is not recommended. |
range |
the value defines how far the parameters can deviate from the last iteration in the computation of the second-stage design parameters, default=1. Change is not recommended. |
t1_p1 |
this value defines the lower limit of the possible range of t1 depending on the single-stage accrual time, default=0.2. Change is not recommended. |
t1_p2 |
this value defines the upper limit of the possible range of t1 depending on the single-stage accrual time, default=0.2. Change is not recommended. |
c1_p |
this value defines the initial center in the possible range of c1, default=0.25. Change is not recommended. |
nbpt_p |
this value defines the initial number of points checked within possible ranges for n, t1 and c1, default=11. Change is not recommended. |
pascote_p |
this value defines how fast the possible ranges of the two-stage design parameters shrink on each iteration, default=1.26. Change is not recommended. |
restricted |
whether using restricted (1) or unrestricted (0) follow-up, default = 0. |
Value
The function returns a list that includes Single_stage, Two_stage_Optimal, Two_stage_minmax, and Two_stage_Admissible, etc.
Single_stage contains the design parameters for the single-stage design:
-
nsignle the required sample size for the single-stage design.
-
tasingle the estimated accrual time for the single-stage design.
-
csingle the critical value for the single-stage design.
Two_stage_Optimal contains the design parameters for the
two-stage design based on the optimal method (i.e., minimizing ES):
-
n1 and n required sample sizes in the two-stage design by the interim and final stage, respectively.
-
c1 and c critical values in the two-stage design for interim and final analysis, respectively.
-
t1 the interim analysis time in the two-stage design.
-
MTSL the maximum total study length (the sum of the accrual time and the follow-up time).
-
ES the expected sample size under null in the two-stage design.
-
PS the probability of early stopping under null in the two-stage design.
Two_stage_minmax contains the design parameters for the two- stage design based on the minmax method (i.e., minimizing the total sample size, n), including the same parameters as for the optimal method.
Two_stage_Admissible contains the design parameters for the
two-stage design based on the admissible method (i.e., a "compromise"
between the optimal and the minmax method), including the same parameters
as for the optimal method, as well as:
-
Rho The expected loss. Between the total sample size n derived from the minmax and the optimal method, the admissible method calculates a design for each possible value of n. The design with the lowest Rho value (i.e., first row in the output) is the recommended design based on the admissible method with the specified q-value.
Other outputs:
-
param The input values to the arguments.
-
difn_opSg The difference in n between the single-stage design and the optimal two-stage designs.
-
difn_opminmax The difference in n between the optimal and the minmax two-stage designs.
-
minmax.err 0 or 1. If minmax.err=1, optimization for the minmax method is incomplete.
-
optimal.err 0 or 1. If optimal.err=1, optimization for the optimal method is incomplete.
-
admiss.err 0 or 1. If admiss.err=1, optimization for a given n value in the admissible method is incomplete.
-
admiss.null1 0 or 1. If admiss.null1=1, the admissible result is unavailable due to incomplete optimization with either the minmax or the optimal method.
-
admiss.null2 0 or 1. If admiss.null2=1, the admissible result is unavailable as either the minmax or the optimal result is unavailable.
-
admiss.null3 0 or 1. If admiss.null3=1, the admissible result is unavailable as n in the minmax result and n in the optimal result are equal.
References
Wu, J, Chen L, Wei J, Weiss H, Chauhan A. (2020). Two-stage phase II survival trial design. Pharmaceutical Statistics. 2020;19:214-229. https://doi.org/10.1002/pst.1983
Examples
# 1. An example when q_value=0.1, i.e, more importance is given to ES.
# phase2.TTE(shape=0.5, S0=0.6, x0=3, hr=0.5, tf=1, rate=5,
# alpha=0.05, beta=0.15, q_value=0.1, prStop=0, restricted=0)
# $param
# shape S0 hr alpha beta rate x0 tf q_value prStop restricted
# 1 0.5 0.6 0.5 0.05 0.15 5 3 1 0.1 0 0
#
# $Single_stage
# nsingle tasingle csingle
# 1 45 9 1.644854
#
# $Two_stage_Optimal
# n1 c1 n c t1 MTSL ES PS
# 1 29 0.1389 48 1.6159 5.7421 10.6 37.29 0.5552
#
# $Two_stage_minmax
# n1 c1 n c t1 MTSL ES PS
# 1 34 0.1151 45 1.6391 6.7952 10 38.9831 0.5458
#
# $Two_stage_Admissible
# n1 c1 n c t1 MTSL ES PS Rho
# 123 29 0.0705 47 1.6232 5.7261 10.4 37.2993 0.5281 38.26937
# 285 28 0.0792 48 1.6171 5.5663 10.6 37.2790 0.5316 38.35110
# 1701 31 0.0733 46 1.6293 6.0191 10.2 37.5828 0.5292 38.42452
# 170 33 -0.0405 45 1.6391 6.4245 10.0 38.7692 0.4839 39.39228
#
# $difn_opSg
# [1] 3
#
# $difn_opminmax
# [1] 3
#
# $minmax.err
# [1] 0
#
# $optimal.err
# [1] 0
#
# $admiss.err
# [1] 0
#
# $admiss.null1
# [1] 0
#
# $admiss.null2
# [1] 0
#
# $admiss.null3
# [1] 0
# 2. An example when q_value=0.75, i.e., more importance is given to n.
# phase2.TTE(shape=0.5, S0=0.6, x0=3, hr=0.5, tf=1, rate=5,
# alpha=0.05, beta=0.15, q_value=0.75, prStop=0, restricted=0)
# $param
# shape S0 hr alpha beta rate x0 tf q_value prStop restricted
# 1 0.5 0.6 0.5 0.05 0.15 5 3 1 0.75 0 0
#
# $Single_stage
# nsingle tasingle csingle
# 1 45 9 1.644854
#
# $Two_stage_Optimal
# n1 c1 n c t1 MTSL ES PS
# 1 29 0.1389 48 1.6159 5.7421 10.6 37.29 0.5552
#
# $Two_stage_minmax
# n1 c1 n c t1 MTSL ES PS
# 1 34 0.1151 45 1.6391 6.7952 10 38.9831 0.5458
#
# $Two_stage_Admissible
# n1 c1 n c t1 MTSL ES PS Rho
# 170 33 -0.0405 45 1.6391 6.4245 10.0 38.7692 0.4839 43.44230
# 1701 31 0.0733 46 1.6293 6.0191 10.2 37.5828 0.5292 43.89570
# 123 29 0.0705 47 1.6232 5.7261 10.4 37.2993 0.5281 44.57483
# 285 28 0.0792 48 1.6171 5.5663 10.6 37.2790 0.5316 45.31975
#
# $difn_opSg
# [1] 3
#
# $difn_opminmax
# [1] 3
#
# $minmax.err
# [1] 0
#
# $optimal.err
# [1] 0
#
# $admiss.err
# [1] 0
#
# $admiss.null1
# [1] 0
#
# $admiss.null2
# [1] 0
#
# $admiss.null3
# [1] 0