Type: Package
Title: Create and Evaluate Stopping Rules for Safety Monitoring
Version: 0.6
Maintainer: Michael J. Martens <mmartens@mcw.edu>
Description: Provides functions for creating, displaying, and evaluating stopping rules for safety monitoring in clinical studies.
Imports: stats, utils, graphics, pracma, matrixStats
License: GPL-3
Encoding: UTF-8
RoxygenNote: 7.3.2
NeedsCompilation: no
Author: Michael J. Martens [aut, cre], Qinghua Lian [aut], Brent R. Logan [ctb]
Repository: CRAN
Packaged: 2025-07-18 21:02:35 UTC; mmartens
Date/Publication: 2025-07-18 21:20:02 UTC

Create and Evaluate Stopping Rules for Safety Monitoring

Description

Provides functions for creating, displaying, and evaluating stopping rules for safety monitoring in clinical studies.

Author(s)

Michael J. Martens mmartens@mcw.edu


Operating Characteristics Function

Description

A wrapper function to compute operating characteristics for a stopping rule at a set of toxicity rates.

Usage

OC.rule(data.type, ...)

Arguments

data.type

Data and monitoring strategy, choices include 'bin' for binary data, 'surv' for time-to-event data using Poisson approach, and 'tite' for time-to-event data using TITE method.

...

Other options to be passed to the corresponding operating characteristics calculation. Please refer to the corresponding OC.rule() function for more details

Value

Please refer to the corresponding data type-specific OC.rule() function for more details

Examples

## Not run: bb_rule = calc.rule(data.type="bin",ns=1:50,p0=0.20,alpha=0.10,type="BB",param=c(2,8))
gp_rule = calc.rule(data.type="surv",n=50,p0=0.20,alpha=0.10,type="GP",tau=60,param=c(1,1000))
poc_rule = calc.rule.tite(n=50, p0=0.2, alpha = 0.10, type = "Pocock")
OC.rule(data.type="bin",rule=bb_rule,ps=seq(0.1, 0.5, 0.1))
OC.rule(data.type="bin",rule=bb_rule,ps=seq(0.1, 0.5, 0.1),tau=60,A=730)
OC.rule(data.type="surv",rule=gp_rule,ps=seq(0.1, 0.5, 0.1),MC=1000, A=730)
OC.rule(data.type="tite",rule=poc_rule,ps=seq(0.2,0.4,0.05),
MC=1000, tau=30,A=730, family='weibull', s=2)

## End(Not run)

Operating Characteristics Function (Binary Data)

Description

Compute operating characteristics for a stopping rule at a set of toxicity rates. Characteristics calculated include the overall rejection probability, the expected number of patients evaluated, and the expected number of events.

Usage

OC.rule.bin(rule, ps, tau = NULL, A = NULL)

Arguments

rule

A rule.bin object calculated by calc.rule.bin() function

ps

A vector of toxicity probabilities at which the operating characteristics will be computed

tau

Length of observation period

A

Length of the enrollment period

Details

If tau and A are specified, the expected number of events includes events among patients who are still pending evaluation at the time of early stopping, computed under an assumption of a random uniform accrual distribution. Otherwise, only events that occurred prior to stopping are included, as the number of events occurring in pending patients depends on tau and A.

Value

A matrix with columns containing the toxicity probabilities ps, the corresponding rejection probabilities, and the corresponding expected number of events. If tau and A are also specified, the expected numbers of enrolled patients and the expected calendar time at the point of stopping/study end are also included.

Examples

## Not run: # Binomial Pocock test in 50 patient cohort at 10% level, expected toxicity probability of 20%
poc_rule = calc.rule.bin(ns=1:50,p0=0.20,alpha=0.10,type="Pocock")

# Bayesian beta-binomial method of Geller et al. in 50 patient cohort at 10% level,
# expected toxicity probability of 20%
bb_rule = calc.rule.bin(ns=1:50,p0=0.20,alpha=0.10,type="BB",param=c(2,8))

# Compute operating characteristics at toxicity probabilities of 20%, 25%, 30%, 35%, and 40%
OC.rule.bin(rule=poc_rule,ps=seq(0.2,0.4,0.05))
OC.rule.bin(rule=bb_rule,ps=seq(0.2,0.4,0.05),tau=30,A=730)

## End(Not run)

Operating Characteristics Function (Survival Data)

Description

Compute operating characteristics for a stopping rule at a set of toxicity rates. Characteristics calculated include the overall rejection probability, the expected number of patients evaluated, and the expected number of events for time-to-event data.

Usage

OC.rule.surv(rule, ps, MC, A, s = 1)

Arguments

rule

A rule.surv object calculated by calc.rule.surv() function

ps

A vector of toxicity probabilities at which the operating characteristics will be computed

MC

Number of Monte Carlo replicates to simulate for estimating operating characteristics. If MC = 0, a Poisson process assumption on the event process is used to compute operating characteristics.

A

Length of the enrollment period. Only required if MC > 0.

s

Shape parameter for the Weibull distribution used to simulate event times. Default is s = 1 (exponential). Only required if MC > 0.

Details

Operating characteristics are generated either by Monte Carlo estimation or computed directly under a Poisson process assumption for the event process over time. The Monte Carlo approach assumes a random uniform accrual distribution and a Weibull event time distribution with distribution function exp(-\lambda * t^s), so it requires specification of the enrollment period length and shape parameter of the event distribution.

Value

A matrix with columns containing the toxicity probabilities ps, the corresponding rejection probabilities, and the corresponding expected number of events. If MC is not NULL, the expected number of enrolled patients and expected calendar time at the point of stopping/study end are also included.

Examples

## Not run:  poc_rule = calc.rule.surv(n=50,p0=0.20,alpha=0.10,type="Pocock",tau=100)
gp_rule = calc.rule.surv(n=50,p0=0.20,alpha=0.10,type="GP",tau=60,param=c(1,1000))
OC.rule.surv(rule=poc_rule,ps=seq(0.2,0.4,0.05),MC=0)
OC.rule.surv(rule=gp_rule,ps=seq(0.2,0.4,0.05),MC=0)

set.seed(82426499)
ps = seq(0.15,0.35,0.05)
wt_rule = calc.rule.surv(n=46,p0=0.15,alpha=0.10,type="WT",tau=100,param=0.25)
OC.rule.surv(rule=wt_rule,ps=ps,MC=1000,A=1095)

p1h = 0.3418071
sp_rule = calc.rule.surv(n=46,p0=0.15,alpha=0.10,type="SPRT",tau=100,param=p1h)
OC.rule.surv(rule=sp_rule,ps=ps,MC=1000,A=1095)

gp_rule = calc.rule.surv(n=46,p0=0.15,alpha=0.10,type="GP",tau=100,
                          param=11.5*c(-log(1-0.15),100))
OC.rule.surv(rule=gp_rule,ps=ps,MC=1000,A=1095)

## End(Not run)

Operating Characteristics Function (TITE Method)

Description

Compute operating characteristics for a stopping rule at a set of toxicity rates. Characteristics calculated include the overall rejection probability, the expected number of patients evaluated, and the expected number of events.

Usage

OC.rule.tite(rule, ps, ps.compt = NULL, MC, tau, A, family = "power", s = 1)

Arguments

rule

A rule.tite object with the safety stopping rule for evaluation

ps

Vector of cumulative incidence probabilities for toxicity at time tau

ps.compt

Vector of cumulative incidence probabilities for competing risks at time tau if competing risks are involved. Set to NULL if no competing risks exist.

MC

Number of Monte Carlo replicated datasets to simulate

tau

Length of observation period

A

Length of accrual period

family

Event time distribution, choices including power distribution ('power') and Weibull distribution ('weibull')

s

Shape parameter for Weibull distribution or power parameter for power distribution

Details

Times are generated for each event cause so that its marginal distribution follows a Weibull or power family distribution as specified by the user.

For the Weibull distribution, the cumulative distribution function is 1- \exp(- \lambda t^s), t \ge 0, where \lambda is the rate parameter and s is the shape parameter.

The power distribution has the cumulative distribution function k (t /\tau)^s, 0 \le t \le \tau k^{-1/s}, where s is the power parameter and k is the value at t=\tau.

For the toxicity event distribution, the Weibull rate parameter is \lambda = - \log(1-p) / \tau and the power parameter is k = p, where p is the cumulative incidence of toxicity at t=\tau. For competing risk events' distribution, \lambda = - 1 / \tau \log(1-p_c) and k = p_c, where p_c is the cumulative incidence of competing events at t=\tau.

Value

A matrix with columns containing the toxicity probabilities ps, competing risk probability (0 for survival outcome), the corresponding rejection probabilities, and the corresponding expected number of events. If tau and A are also specified, the expected numbers of enrolled patients and the expected calendar time at the point of stopping/study end are also included.

Examples

## Not run: 
# Bayesian beta-extended binomial method in 50 patient cohort at 10% level,
# expected toxicity probability of 20%
bb_rule = calc.rule.tite(n=50,p0=0.20,alpha=0.10,type="BB",param=c(2,8))

# Compute operating characteristics at toxicity probabilities of 20%, 25%, 30%, 35%, and 40%
OC.rule.tite(rule=bb_rule,ps=seq(0.2,0.4,0.05), MC =1000, tau=30,A=730, family = 'weibull', s = 2)

## End(Not run)

Stopping Rule Boundary Function

Description

A wrapper function to calculate the boundary for a given stopping rule for safety monitoring for time-to-event data or binary data

Usage

bdryfcn(data.type, ...)

Arguments

data.type

Data and monitoring strategy, choices include 'bin' for binary data, 'surv' for time-to-event data using Poisson approach, and 'tite' for time-to-event data using TITE method.

...

Other options to be passed to the corresponding stopping rule calculation. Please refer to the corresponding data type-specific bdryfcn() function for more details

Value

A univariate function that defines the rejection boundary at any number of evaluable patients (binary data), amount of follow-up time (time-to-event data), or effective sample size accounting for partial follow up (TITE method).


Stopping Rule Boundary Function (Binary Data)

Description

Calculate the boundary for a given stopping rule

Usage

bdryfcn.bin(n, p0, type, cval, param = NULL)

Arguments

n

Maximum sample size for safety monitoring

p0

The toxicity probability under the null hypothesis

type

The method used for constructing the stopping rule. Choices include a Pocock test ("Pocock"), an O'Brien-Fleming test ("OBF"), a Wang-Tsiatis test ("WT"), the Bayesian beta-binomial method ("BB") proposed by Geller et al. 2003, the Bayesian beta-binomial method ("CC") proposed by Chen and Chaloner 2006, a truncated SPRT ("SPRT"), and a maximized SPRT ("MaxSPRT").

cval

Critical value for stopping rule method. For Wang-Tsiatis tests, this is the Delta parameter. For the Bayesian Beta-Binomial method, this is the threshold on the posterior probability. For the truncated SPRT, this is the threshold on the log likelihood ratio. For the MaxSPRT, this is the threshold on the log generalized likelihood ratio.

param

A vector of the extra parameter(s) needed for certain stopping rule methods. For binomial Wang-Tsiatis tests, this is the Delta parameter. For the Geller et al. method, this is the vector of hyperparameters (a,b) for the beta prior on the toxicity probability. For Chen and Chaloner's method, this is the vector (a,b,p1,nu), containing the hyperparameters (a,b) for the beta prior on the toxicity probability, the targeted alternative toxicity probability p1, and the threshold nu for the posterior probability that the true toxicity probability p > p1. For truncated SPRT, this is the targeted alternative toxicity probability p1.

Value

A univariate function that defines the rejection boundary at any number of evaluable patients


The Inverse Function of the Stopping Rule Boundary (Binary Data)

Description

Calculate the inverse of the boundary for a given stopping rule

Usage

bdryfcn.bin.inverse(b, n, p0, type, cval, param = NULL)

Arguments

b

Number of toxicities

n

Sample size

p0

The toxicity probability under the null hypothesis

type

The method used for constructing the stopping rule. Choices include a Pocock test ("Pocock"), an O'Brien-Fleming test ("OBF"), a Wang-Tsiatis test ("WT"), the Bayesian beta-binomial method ("BB") proposed by Geller et al. 2003, a truncated SPRT ("SPRT"), and a maximized SPRT ("MaxSPRT").

cval

Critical value for stopping rule method. For Wang-Tsiatis tests, this is the Delta parameter. For the Bayesian Beta-Binomial method, this is the threshold on the posterior probability. For the truncated SPRT, this is the threshold on the log likelihood ratio. For the MaxSPRT, this is the threshold on the log generalized likelihood ratio.

param

A vector of the extra parameter(s) needed for certain stopping rule methods. For binomial Wang-Tsiatis tests, this is the Delta parameter. For the Geller et al. method, this is the vector of hyperparameters (a,b) for the beta prior on the toxicity probability. For Chen and Chaloner's method, this is the vector (a,b,p1,nu), containing the hyperparameters (a,b) for the beta prior on the toxicity probability, the targeted alternative toxicity probability p1, and the threshold nu for the posterior probability that the true toxicity probability p > p1. For truncated SPRT, this is the targeted alternative toxicity probability p1.

Value

A univariate function that defines the effective sample size value corresponding to the number of toxicities (used in TITE method)


Stopping Rule Boundary Function (Survival Data)

Description

Calculate the boundary for a given stopping rule

Usage

bdryfcn.surv(n, p0, type, tau, cval, param = NULL)

Arguments

n

Maximum sample size for safety monitoring

p0

The probability of a toxicity occurring in tau units of time under the null hypothesis

type

The method used for constructing the stopping rule. Choices including a Pocock test ("Pocock"), a O'Brein-Fleming test ("OBF"), a Wang-Tsiatis test ("WT"), the Bayesian Gamma-Poisson method ("GP"), a truncated sequential probability ratio test ("SPRT"), and a maximized SPRT ("MaxSPRT")

tau

Length of observation period

cval

Critical value for the stopping rule. For Wang-Tsiatis tests, this is the Delta parameter. For the Bayesian Gamma-Poisson method, this is the threshold on the posterior probability. For the truncated SPRT, this is the threshold on the log likelihood ratio. For the MaxSPRT, this is the threshold on the log generalized likelihood ratio.

param

A vector of the extra parameter(s) needed for certain stopping rule methods. For Wang-Tsiatis tests, this is the Delta parameter. For truncated SPRT, this is the targeted alternative toxicity probability p1. For Bayesian Gamma-Poisson model, this is the vector of hyperparameters (shape,rate) for the gamma prior on the toxicity event rate.

Value

A univariate function that defines the rejection boundary at any amount of total follow-up time


Stopping Boundary Calculation (Binary Data)

Description

Internal workhorse function to calculate stopping boundary for a given method, treating toxicities as binary data

Usage

calc.bnd.bin(n, p0, type, cval, param)

Arguments

n

Maximum sample size for safety monitoring

p0

The toxicity probability under the null hypothesis

type

The method used for constructing the stopping rule

cval

Critical value for stopping rule method. For Wang-Tsiatis tests, this is the Delta parameter. For the Bayesian Beta-Binomial method, this is the threshold on the posterior probability. For the truncated SPRT, this is the threshold on the log likelihood ratio. For the MaxSPRT, this is the threshold on the log generalized likelihood ratio.

param

A vector of the extra parameter(s) needed for certain stopping rule methods. For binomial Wang-Tsiatis tests, this is the Delta parameter. For the Geller et al. method, this is the vector of hyperparameters (a,b) for the beta prior on the toxicity probability. For Chen and Chaloner's method, this is the vector (a,b,p1,nu), containing the hyperparameters (a,b) for the beta prior on the toxicity probability, the targeted alternative toxicity probability p1, and the threshold nu for the posterior probability that the true toxicity probability p > p1. For truncated SPRT, this is the targeted alternative toxicity probability p1.

Value

A vector of stopping boundaries at the sample sizes 1, 2, ..., n


Stopping Boundary Calculation (Survival Data)

Description

Internal workhorse function to calculate stopping boundary for a given method for time-to-event data

Usage

calc.bnd.surv(n, p0, type, tau, cval, maxInf = "expected", param = NULL)

Arguments

n

maximum sample size for safety monitoring

p0

The probability of a toxicity occurring in tau units of time under the null hypothesis

type

The method used for constructing the stopping rule

tau

Length of observation period

cval

Critical value for the stopping rule. For Wang-Tsiatis tests, this is the Delta parameter. For the Bayesian Gamma-Poisson method, this is the threshold on the posterior probability. For the truncated SPRT, this is the threshold on the log likelihood ratio. For the MaxSPRT, this is the threshold on the log generalized likelihood ratio.

maxInf

Specification of the maximum information (maximum exposure time) used for designing the stopping rule. Options include the expected exposure time for n patients used H0 ("expected") and the maximum possible exposure time ("maximum"). Default is "expected" (expected exposure time in cohort).

param

A vector of the extra parameter(s) needed for certain stopping rule methods. For Wang-Tsiatis tests, this is the Delta parameter. For truncated SPRT, this is the targeted alternative toxicity probability p1. For Bayesian Gamma-Poisson model, this is the vector of hyperparameters (shape,rate) for the gamma prior on the toxicity event rate.

Value

A list of three items: tau, number of events that can trigger a stop, and the corresponding total follow up time.


Stopping Rule Calculation

Description

A wrapper function to calculate a stopping rule for safety monitoring for time-to-event data or binary data

Usage

calc.rule(data.type, ...)

Arguments

data.type

Data and monitoring strategy, choices include 'bin' for binary data, 'surv' for time-to-event data using Poisson approach, and 'tite' for time-to-event data using TITE method.

...

Other options to be passed to the corresponding stopping rule calculation. Please refer to the corresponding data type-specific calc.rule() function for more details

Value

Please refer to the corresponding data type-specific calc.rule() function for details on its output

Examples

## Not run: 
calc.rule(data.type="bin",ns=1:50,p0=0.20,alpha=0.10,type="WT",param=0.25)
calc.rule(data.type="surv",n=50,p0=0.20,alpha=0.10,type="WT",tau=100,param=0.25)
calc.rule(data.type="tite",n=100,p0=0.10,alpha=0.05,type="BB",param=c(1,9))

## End(Not run)

Stopping Rule Calculation (Binary Data)

Description

Calculate a stopping rule for safety monitoring, treating toxicities as binary data

Usage

calc.rule.bin(ns, p0, alpha, type, param = NULL, iter = 50)

Arguments

ns

A vector of sample sizes at which sequential testing is performed

p0

The toxicity probability under the null hypothesis

alpha

The desired type I error / false positive rate for the stopping rule

type

The method used for constructing the stopping rule. Choices include a Pocock test ("Pocock"), an O'Brien-Fleming test ("OBF"), a Wang-Tsiatis test ("WT"), the Bayesian beta-binomial method ("BB") proposed by Geller et al. 2003, the Bayesian beta-binomial method ("CC") proposed by Chen and Chaloner 2006, a truncated SPRT ("SPRT"), and a maximized SPRT ("MaxSPRT").

param

A vector of the extra parameter(s) needed for certain stopping rule methods. For binomial Wang-Tsiatis tests, this is the Delta parameter. For the Geller et al. method, this is the vector of hyperparameters (a,b) for the beta prior on the toxicity probability. For Chen and Chaloner's method, this is the vector (a,b,p1,nu), containing the hyperparameters (a,b) for the beta prior on the toxicity probability, the targeted alternative toxicity probability p1, and the threshold nu for the posterior probability that the true toxicity probability p > p1. For truncated SPRT, this is the targeted alternative toxicity probability p1.

iter

The number of iterations used to search for the boundary

Value

A rule.bin object, which is a list with the following elements: Rule, a two-column matrix with the sample sizes ns and their corresponding rejection boundaries; ns; p0; alpha; type; param; and cval, the boundary parameter for the rule

References

Chen, C. and Chaloner, K. (2006). A Bayesian stopping rule for a single arm study: With a case study of stem cell transplantation. Statistics in Medicine 25(17), 2956-66.

Geller, N.L., Follman, D., Leifer, E.S. and Carter, S.L. (2003). Design of early trials in stem cell transplantation: a hybrid frequentist-Bayesian approach. Advances in Clinical Trial Biostatistics.

Goldman, A.I. (1987). Issues in designing sequential stopping rules for monitoring side effects in clinical trials. Controlled Clinical Trials 8(4), 327-37.

Ivanova, A., Qaqish, B.F. and Schell, M.J. (2005). Continuous toxicity monitoring in phase II trials in oncology. Biometrics 61(2), 540-545.

Kulldorff, M., Davis, R.L., Kolczak, M., Lewis, E., Lieu, T. and Platt, R. (2011). A maximized sequential probability ratio test for drug and vaccine safety surveillance. Sequential Analysis 30(1), 58-78.

Martens, M.J. and Logan, B.R. (2024). Statistical Rules for Safety Monitoring in Clinical Trials. Clinical Trials 21(2), 152-161.

Pocock, S.J. (1977). Group sequential methods in the design and analysis of clinical trials. Biometrika 64(2), 191-199.

Wang, S.K. and Tsiatis, A.A. (1987). Approximately optimal one-parameter boundaries for group sequential trials. Biometrics 193-199.

Examples

## Not run: # Binomial Pocock test in 50 patient cohort at 10% level, expected toxicity
# probability of 20%
calc.rule.bin(ns=1:50,p0=0.20,alpha=0.10,type="Pocock")

# Binomial Wang-Tsiatis test with Delta = 0.25 in 50 patient cohort at 10% level,
# expected toxicity probability of 20%
calc.rule.bin(ns=1:50,p0=0.20,alpha=0.10,type="WT",param=0.25)

# Beta-binomial test of Geller et al. 2003 with hyperparameters (1, 9) in 100
# patient cohort at 5% level, expected toxicity probability of 10%
calc.rule.bin(ns=1:100,p0=0.10,alpha=0.05,type="BB",param=c(1,9))

# Binomial truncated SPRT with p1 = 0.3 in 100 patient cohort at 5% level,
# expected toxicity probability of 10%
calc.rule.bin(ns=1:100,p0=0.10,alpha=0.05,type="SPRT",param=0.3)

## End(Not run)

Stopping Rule Calculation (Survival Data)

Description

Calculate a stopping rule for safety monitoring for time-to-event data

Usage

calc.rule.surv(n, p0, alpha, type, tau, maxInf = "expected", param = NULL)

Arguments

n

Maximum sample size for safety monitoring

p0

The probability of a toxicity occurring in tau units of time under the null hypothesis

alpha

The nominal type I error/false positive rate for the stopping rule, under an assumption that the cumulative number of events follows a Poisson process over the study duration.

type

The method used for constructing the stopping rule. Choices including a Pocock test ("Pocock"), a O'Brien-Fleming test ("OBF"), a Wang-Tsiatis test ("WT"), the Bayesian Gamma-Poisson method ("GP"), a truncated sequential probability ratio test ("SPRT"), and a maximized SPRT ("MaxSPRT")

tau

Length of observation period

maxInf

Specification of the maximum information (maximum exposure time) used for designing the stopping rule. Options include the expected exposure time for n patients used H0 ("expected") and the maximum possible exposure time ("maximum"). Default is "expected" (expected exposure time in cohort).

param

A vector of the extra parameter(s) needed for certain stopping rule methods. For Wang-Tsiatis tests, this is the Delta parameter. For truncated SPRT, this is the targeted alternative toxicity probability p1. For Bayesian Gamma-Poisson model, this is the vector of hyperparameters (shape,rate) for the gamma prior on the toxicity event rate.

Value

A rule.surv object, which is a list with the following elements: Rule, a two-column matrix with total follow-up times for each stage and their corresponding rejection boundaries; n; p0; alpha; type; tau; param; and cval, the boundary parameter for the rule

References

Martens, M. J., Lian, Q., Geller, N. L., Leifer, E. S., and Logan, B. L. (2025). Sequential monitoring of time-to-event safety endpoints in clinical trials. Clinical Trials, 22(3), 267–278.

Kashiwabara, K., Matsuyama, Y., and Ohashi, Y. (2014). A Bayesian stopping rule for sequential monitoring of serious adverse events. Therapeutic Innovation & Regulatory Science, 48, 444–452.

Kulldorff, M., Davis, R. L., Kolczak, M., Lewis, E., Lieu, T., and Platt, R. (2011). A maximized sequential probability ratio test for drug and vaccine safety surveillance. Sequential Analysis, 30(1), 58–78.

Zacks, S. and Mukhopadhyay, N. (2006). Exact risks of sequential point estimators of the exponential parameter. Sequential Analysis, 25(2), 203–226.

Examples

## Not run: # Survival Pocock test in 50 patient cohort at 10% level, expected toxicity
# probability of 20%, 100 day observation period
calc.rule.surv(n=50,p0=0.20,alpha=0.10,type="Pocock",tau=100)

# Survival Wang-Tsiatis test with Delta = 0.25 in 50 patient cohort at 10% level,
# expected toxicity probability of 20%, 100 day observation period
calc.rule.surv(n=50,p0=0.20,alpha=0.10,type="WT",tau=100,param=0.25)

# Gamma-Poisson test with hyperparameters (1, 1000) in 100 patient cohort at 5% level,
# expected toxicity probability of 10%, 60 day observation period
calc.rule.surv(n=100,p0=0.10,alpha=0.05,type="GP",tau=60,param=c(1,1000))

# Truncated exponential SPRT with p1 = 0.3 in 100 patient cohort at 5% level,
# expected toxicity probability of 10%, 60 day observation period
calc.rule.surv(n=100,p0=0.10,alpha=0.05,type="SPRT",tau=60,param=0.3)

## End(Not run)

Stopping Rule Calculation (TITE method)

Description

Calculate a stopping rule for safety monitoring of time-to-event data using the TITE approach.

Usage

calc.rule.tite(n, p0, alpha, type, param = NULL, iter = 50)

Arguments

n

Maximum sample size

p0

The toxicity probability under the null hypothesis

alpha

The desired type I error / false positive rate for the stopping rule

type

The method used for constructing the TITE stopping rule. Choices include a Pocock test ("Pocock"), an O'Brien-Fleming test ("OBF"), a Wang-Tsiatis test ("WT"), the Bayesian beta-extended binomial method ("BB"), a truncated SPRT ("SPRT"), and a maximized SPRT ("MaxSPRT").

param

A vector of the extra parameter(s) needed for certain stopping rule methods. For Wang-Tsiatis tests, this is the Delta parameter. For the Geller et al. method, this is the vector of hyperparameters (a,b) for the beta prior on the toxicity probability. For truncated SPRT, this is the targeted alternative toxicity probability p1.

iter

The number of iterations used to search for the boundary

Value

A rule.tite object, which is a list with the following elements: Rule, a two-column matrix with the effective sample sizes and their corresponding rejection boundaries; n; p0; alpha; type; param; and cval, the boundary parameter for the rule

References

Geller, N.L., Follman, D., Leifer, E.S. and Carter, S.L. (2003). Design of early trials in stem cell transplantation: a hybrid frequentist-Bayesian approach. Advances in Clinical Trial Biostatistics.

Goldman, A.I. (1987). Issues in designing sequential stopping rules for monitoring side effects in clinical trials. Controlled Clinical Trials 8(4), 327-37.

Ivanova, A., Qaqish, B.F. and Schell, M.J. (2005). Continuous toxicity monitoring in phase II trials in oncology. Biometrics 61(2), 540-545.

Kulldorff, M., Davis, R.L., Kolczak, M., Lewis, E., Lieu, T. and Platt, R. (2011). A maximized sequential probability ratio test for drug and vaccine safety surveillance. Sequential Analysis 30(1), 58-78.

Martens, M.J. and Logan, B.R. (2024). Statistical Rules for Safety Monitoring in Clinical Trials. Clinical Trials 21(2), 152-161.

Wang, S.K. and Tsiatis, A.A. (1987). Approximately optimal one-parameter boundaries for group sequential trials. Biometrics 193-199.

Examples

## Not run: # Pocock test in 50 patient cohort at 10% level, expected toxicity probability of 20%


Search for Calibration Value (Binary Data)

Description

Internal workhorse function to calculate the calibration constant value that attains level alpha for given method

Usage

findconst.bin(ns, p0, alpha, type, l, u, iter = 50, param)

Arguments

ns

A vector of sample sizes at which sequential testing is performed

p0

The toxicity probability under the null hypothesis

alpha

The desired type I error / false positive rate for the stopping rule

type

The method used for constructing the stopping rule

l

Lower starting value of bracket for calibration constant

u

Upper starting value of bracket for calibration constant

iter

The number of iterations used to search for the boundary

param

A vector of the extra parameter(s) needed for certain stopping rule methods. For binomial Wang-Tsiatis tests, this is the Delta parameter. For the Geller et al. method, this is the vector of hyperparameters (a,b) for the beta prior on the toxicity probability. For Chen and Chaloner's method, this is the vector (a,b,p1,nu), containing the hyperparameters (a,b) for the beta prior on the toxicity probability, the targeted alternative toxicity probability p1, and the threshold nu for the posterior probability that the true toxicity probability p > p1. For truncated SPRT, this is the targeted alternative toxicity probability p1.

Value

The calibration constant used for subsequent stopping boundary calculation


Search for Calibration Value (Survival Data)

Description

Internal workhorse function to calculate the calibration constant value that attains level alpha for given method for time-to-event data

Usage

findconst.surv(n, p0, alpha, type, tau, maxInf = "expected", param = NULL)

Arguments

n

Maximum sample size for safety monitoring

p0

The probability of a toxicity occurring in tau units of time under the null hypothesis

alpha

The nominal type I error/false positive rate for the stopping rule, under an assumption that the cumulative number of events follows a Poisson process over the study duration.

type

The method used for constructing the stopping rule

tau

Length of observation period

maxInf

Specification of the maximum information (maximum exposure time) used for designing the stopping rule. Options include the expected exposure time for n patients used H0 ("expected") and the maximum possible exposure time ("maximum"). Default is "expected" (expected exposure time in cohort).

param

A vector of the extra parameter(s) needed for certain stopping rule methods. For Wang-Tsiatis tests, this is the Delta parameter. For truncated SPRT, this is the targeted alternative toxicity probability p1. For Bayesian Gamma-Poisson model, this is the vector of hyperparameters (shape,rate) for the gamma prior on the toxicity event rate.

Value

The calibration constant used for subsequent stopping boundary calculation


Add Stopping Rule Curve to Current Plot (Binary Data)

Description

Add a binary stopping rule graphically as a curve on current plot

Usage

## S3 method for class 'rule.bin'
lines(x, smooth = TRUE, ...)

Arguments

x

A rule.bin object calculated by calc.rule.bin() function

smooth

Binary indicator of whether stopping rule boundary should be smoothed by linear interpolation between evaluation points

...

Other options to be passed to generic lines function

Value

No return value; function solely modifies current plot

Examples

## Not run: # Binomial Pocock test in 50 patient cohort at 10% level, expected toxicity probability of 20%
poc_rule = calc.rule.bin(ns=1:50,p0=0.20,alpha=0.10,type="Pocock")

# Bayesian beta-binomial method of Geller et al. in 50 patient cohort at 10% level,
# expected toxicity probability of 20%
bb_rule = calc.rule.bin(ns=1:50,p0=0.20,alpha=0.10,type="BB",param=c(2,8))

# Plot stopping boundaries for stopping rules
plot(poc_rule,col="blue")
lines(bb_rule,col="red")

## End(Not run)

Add Stopping Rule Curve to Current Plot (Survival Data)

Description

Add a survival stopping rule graphically as a curve on current plot for time-to-event data

Usage

## S3 method for class 'rule.surv'
lines(x, ...)

Arguments

x

A rule.surv object calculated by calc.rule.surv() function

...

Other options to be passed to generic lines() function

Value

No return value, function solely modifies current plot

Examples

## Not run: poc_rule = calc.rule.surv(n=50,p0=0.20,alpha=0.10,type="Pocock",tau=100)
gp_rule = calc.rule.surv(n=50,p0=0.20,alpha=0.10,type="GP",tau=100,param=c(1,1000))
plot(poc_rule)
lines(gp_rule,col="red")

## End(Not run)

Add Stopping Rule Curve to Current Plot (TITE Method)

Description

Add a TITE stopping rule graphically as a curve on current plot

Usage

## S3 method for class 'rule.tite'
lines(x, ...)

Arguments

x

A rule.tite object calculated by calc.rule.tite() function

...

Other options to be passed to generic lines function

Value

No return value; function solely modifies current plot

Examples

## Not run: # Binomial Pocock test in 50 patient cohort at 10% level, expected toxicity probability of 20%
poc_rule = calc.rule.tite(n=50,p0=0.20,alpha=0.10,type="Pocock")

# Bayesian beta-extended binomial method in 50 patient cohort at 10% level,
# expected toxicity probability of 20%
bb_rule = calc.rule.tite(n=50,p0=0.20,alpha=0.10,type="BB",param=c(2,8))

# Plot stopping boundaries for stopping rules
plot(poc_rule,col="blue")
lines(bb_rule,col="red")

## End(Not run)

Operating Characteristics Function (Binary Data)

Description

Internal workhorse function to calculate operating characteristics for a given stopping rule and toxicity probability

Usage

opchars.bin(rule, p, tau = NULL, A = NULL)

Arguments

rule

A rule.bin object calculated by calc.rule.bin() function

p

The toxicity probability

tau

Length of observation period

A

Length of the enrollment period.

Value

A list containing the toxicity probability p, and the corresponding rejection probability and expected number of events. If tau and A are also specified, the expected number of enrolled patients and the expected calendar time at the point of stopping/study end are also included.


Operating Characteristics Function (Survival Data)

Description

Internal workhorse function to calculate operating characteristics for a given stopping rule and toxicity probability

Usage

opchars.surv(rule, p, MC, A, s = 1)

Arguments

rule

A rule.surv object calculated by calc.rule.surv() function

p

The toxicity probability

MC

Number of Monte Carlo replicates to simulate for estimating operating characteristics. If MC = 0, a Poisson process assumption on the event process is used to compute operating characteristics.

A

Length of the enrollment period. Only required if MC > 0.

s

Shape parameter for the Weibull distribution used to simulate event times. Only required if MC > 0.

Value

A list containing the rejection probability p, and the corresponding rejection probability and number of events. If MC is not NULL, the expected number of enrolled patients and total follow up time are also included.


Operating Characteristics Function (TITE Method)

Description

Internal workhorse function to calculate operating characteristics for a given stopping rule and toxicity probability

Usage

opchars.tite(rule, p, tau, MC, A, family, s)

Arguments

rule

A rule.tite object with the safety stopping rule for evaluation

p

Vector of cumulative incidence probabilities at time tau for all causes (length 1 for survival, 2 for competing risks)

tau

Length of observation period

MC

Number of Monte Carlo replicated datasets to simulate

A

Length of accrual period

family

Event time distribution, choices including Weibull distribution ('weibull') and power family ('power')

s

Shape parameter for Weibull distribution or power parameter for power family

Value

A list containing the toxicity probability p, and the corresponding rejection probability and expected number of events. If tau and A are also specified, the expected number of enrolled patients and the expected calendar time at the point of stopping/study end are also included.


Plot Stopping Rule (Binary Data)

Description

Display a stopping rule graphically as a curve

Usage

## S3 method for class 'rule.bin'
plot(
  x,
  smooth = TRUE,
  xlim = c(0, max(x$ns)),
  ylim = c(0, max(x$Rule[, 2]) + 1),
  xlab = "# Evaluable",
  ylab = "# Events",
  ...
)

Arguments

x

A rule.bin object calculated by calc.rule.bin() function

smooth

Binary indicator of whether stopping rule boundary should be smoothed by linear interpolation between evaluation points

xlim

The x limits (x1, x2) of the plot. Note that x1 > x2 is allowed and leads to a ‘reversed axis’.

ylim

The y limits of the plot.

xlab

The title for the x axis

ylab

The title for the y axis

...

Other options to be passed to generic plot function

Value

No return value; function solely generates a plot

Examples

## Not run: # Binomial Pocock test in 50 patient cohort at 10% level, expected toxicity probability of 20%
poc_rule = calc.rule.bin(ns=1:50,p0=0.20,alpha=0.10,type="Pocock")

# Bayesian beta-binomial method of Geller et al. in 50 patient cohort at 10% level,
# expected toxicity probability of 20%
bb_rule = calc.rule.bin(ns=1:50,p0=0.20,alpha=0.10,type="BB",param=c(2,8))

# Plot stopping boundary with smoothing
plot(poc_rule,col="blue")
lines(bb_rule,col="red")

## End(Not run)

Plot Stopping Rule (Survival Data)

Description

Display a stopping rule graphically as a curve for time-to-event data

Usage

## S3 method for class 'rule.surv'
plot(
  x,
  xlim = c(0, max(x$Rule[, 1])),
  ylim = c(0, max(x$Rule[, 2]) + 1),
  xlab = "Total Exposure Time",
  ylab = "# Events",
  ...
)

Arguments

x

A rule.surv object calculated by calc.rule.surv() function

xlim

The x limits (x1, x2) of the plot. Note that x1 > x2 is allowed and leads to a ‘reversed axis’.

ylim

The y limits of the plot.

xlab

The title for the x axis

ylab

The title for the y axis

...

Other parameters passed to the plot function.

Value

No return value; function solely generates a plot

Examples

## Not run: poc_rule = calc.rule.surv(n=50,p0=0.20,alpha=0.10,type="Pocock",tau=100)
gp_rule = calc.rule.surv(n=50,p0=0.20,alpha=0.10,type="GP",tau=100,param=c(1,1000))
plot(poc_rule)
lines(gp_rule,col="red")

## End(Not run)

Plot Stopping Rule (TITE Method)

Description

Display a stopping rule graphically as a curve

Usage

## S3 method for class 'rule.tite'
plot(
  x,
  xlim = c(0, x$n),
  ylim = c(0, max(x$Rule[, 2]) + 1),
  xlab = " Effective Sample Size",
  ylab = "# Events",
  ...
)

Arguments

x

A rule.tite object calculated by calc.rule.tite() function

xlim

The x limits (x1, x2) of the plot. Note that x1 > x2 is allowed and leads to a ‘reversed axis’.

ylim

The y limits of the plot.

xlab

The title for the x axis

ylab

The title for the y axis

...

Other options to be passed to generic plot function

Value

No return value; function solely generates a plot

Examples

## Not run: # Binomial Pocock test in 50 patient cohort at 10% level, expected toxicity probability of 20%
poc_rule = calc.rule.tite(n=50,p0=0.20,alpha=0.10,type="Pocock")

# Bayesian beta-extended binomial method in 50 patient cohort at 10% level,
# expected toxicity probability of 20%
bb_rule = calc.rule.tite(n=50,p0=0.20,alpha=0.10,type="BB",param=c(2,8))

# Plot stopping boundary
plot(poc_rule,col="blue")
lines(bb_rule,col="red")

## End(Not run)

Simulate time-to-event data for safety monitoring under Weibull distribution or power family (TITE Method)

Description

Simulate time-to-event data for safety monitoring under Weibull distribution or power family (TITE Method)

Usage

sim_tite_data(n, p, tau, A, family, s)

Arguments

n

Sample size

p

Vector of cumulative incidence probabilities at time tau for all causes (length 1 for survival, 2 for competing risks)

tau

Length of observation period

A

Length of accrual period

family

Event time distribution, choices including Weibull distribution ('weibull'), or power family ('power')

s

Shape parameter for Weibull distribution or power parameter for power family

Value

A matrix with three columns: patient enrollment time, event time, and event indicator

Functions


Simulate survival data for safety monitoring under Weibull distribution

Description

Internal function to simulate survival data from Weibull distribution for evaluating safety monitoring rules. A random sample of size n is generated from a Weibull distribution with shape parameter s to attain a toxicity rate of p at survival time tau. Enrollment times are also simulated over an accrual period of duration A under a uniform (0,A) distribution.

Usage

simdata_weibull(n, p, tau, A, s = 1)

Arguments

n

Maximum sample size for safety monitoring

p

The probability of a toxicity occurring in tau units of time under the null hypothesis

tau

Length of observation period

A

Length of accrual period

s

Shape parameter for the Weibull distribution; default value is 1 (exponential distribution)

Value

A matrix with two columns: patient enrollment time and event time


Simulate trials with safety monitoring by survival data stopping rules

Description

Internal workhorse function used to simulate trials with safety monitoring by survival data stopping rules. The provided stopping rule is used for monitoring of MC simulated trials. For each trial, a random sample is generated from a Weibull distribution with shape parameter s to attain a toxicity rate of p. Enrollment times are simulated over an accrual period of duration A under a uniform (0,A) distribution.

Usage

simtrials.surv(rule, p, MC, A, s = 1)

Arguments

rule

A rule.surv object with the safety stopping rule for evaluation

p

The probability of a toxicity occurring in tau units of time under the null hypothesis

MC

Number of Monte Carlo replicated datasets to simulate

A

Length of accrual period

s

Shape parameter for the Weibull distribution; default value is 1 (exponential distribution)

Value

A matrix with MC rows and 14 columns, one row per simulated trial. Columns include the stopping rule type and design parameters, the numbers of events and enrolled patients, the total follow-up time in the cohort, the calendar time when the study ends, the reject/no reject decision, and the last stage of monitoring reached when the study ends.

Examples

## Not run: 
set.seed(13)
wt_rule = calc.rule.surv(n=46,p0=0.15,alpha=0.10,type="WT",tau=100,param=0.25)
sims = simtrials.surv(rule=wt_rule,p=0.15,MC=1000,A=1095)
c(mean(sims$stopped),mean(sims$n.Toxicity),mean(sims$n.Enrolled),mean(sims$Calendar.Time))
sims = simtrials.surv(rule=wt_rule,p=0.35,MC=1000,A=1095)
c(mean(sims$stopped),mean(sims$n.Toxicity),mean(sims$n.Enrolled),mean(sims$Calendar.Time))

gp_rule = calc.rule.surv(n=46,p0=0.15,alpha=0.10,type="GP",tau=100,param=11.5*c(-log(1-0.15),100))
sims = simtrials.surv(rule=gp_rule,p=0.15,MC=1000,A=1095)
c(mean(sims$stopped),mean(sims$n.Toxicity),mean(sims$n.Enrolled),mean(sims$Calendar.Time))
sims = simtrials.surv(rule=gp_rule,p=0.35,MC=1000,A=1095)
c(mean(sims$stopped),mean(sims$n.Toxicity),mean(sims$n.Enrolled),mean(sims$Calendar.Time))

## End(Not run)

Simulate trials with safety monitoring by the TITE method

Description

Internal workhorse function used to simulate trials with safety monitoring by the TITE method. The provided stopping rule is used for monitoring of MC simulated trials. For each trial, a random sample is generated from either a Weibull distribution with shape parameter s or power distribution with power parameter to attain a toxicity rate of p. Enrollment times are simulated over an accrual period of duration A under a uniform (0,A) distribution.

Usage

simtrials.tite(rule, p, tau, MC, A, family, s)

Arguments

rule

A rule.tite object with the safety stopping rule for evaluation

p

Vector of cumulative incidence probabilities at time tau for all causes (length 1 for survival, 2 for competing risks)

tau

Length of observation period

MC

Number of Monte Carlo replicated datasets to simulate

A

Length of accrual period

family

Event time distribution, choices including Weibull distribution ('weibull') and power family ('power')

s

Shape parameter for Weibull distribution or power parameter for power family

Value

A matrix with MC rows and 14 columns, one row per simulated trial. Columns include the stopping rule type and design parameters, the numbers of events and enrolled patients, the total follow-up time in the cohort, the calendar time when the study ends, the reject/no reject decision, and the last stage of monitoring reached when the study ends.

Examples

## Not run: 
set.seed(2025)

## End(Not run)

Calculating the stopping probability given a rejection boundary (Survival Data)

Description

Internal workhouse function to calculate the stopping probability given a rejection boundary for time-to-event data

Usage

stopping.prob.surv(bnd, p)

Arguments

bnd

A list object calculated by calc.bnd.surv function

p

True toxicity probability

Value

A list of three: stopping probabilities at each stage, total stopping probability, and non-stopping probabilities of each possible number of events at the last stage.


Tabulate Stopping Rule (Binary Data)

Description

Summarize a stopping rule in a condensed tabular format

Usage

table.rule.bin(x)

Arguments

x

A rule.bin object calculated by calc.rule.bin() function

Value

A matrix with two columns: the ranges of evaluable patients, and corresponding rejection boundaries for these ranges

Examples

# Binomial Pocock test in 50 patient cohort at 10% level, expected toxicity probability of 20%
## Not run: poc_rule = calc.rule.bin(ns=1:50,p0=0.20,alpha=0.10,type="Pocock")

# Tabulate stopping boundary
table.rule.bin(poc_rule)

## End(Not run)

Tabulate Stopping Rule (Survival data)

Description

Summarize a stopping rule in a condensed tabular format

Usage

table.rule.surv(rule, dec = 0)

Arguments

rule

A rule.surv object calculated by calc.rule.surv() function

dec

Number of decimal places to which the stagewise total follow-up times should be rounded

Value

A matrix with two columns: total follow up time and their corresponding rejection boundary

Examples

## Not run: gp_rule = calc.rule.surv(n=50,p0=0.20,alpha=0.10,type="GP",tau=100,param=c(1,1000))
table.rule.surv(gp_rule,2)

## End(Not run)

Tabulate Stopping Rule (TITE Method)

Description

Summarize a stopping rule in a condensed tabular format

Usage

table.rule.tite(x, dec = 3)

Arguments

x

A rule.tite object calculated by calc.rule.tite() function

dec

Number of decimal places to which the stagewise effective sample sizes should be rounded

Value

A matrix with two columns: the ranges of effective sample sizes, and corresponding rejection boundaries for these ranges

Examples


## Not run: 
# Binomial Pocock test in 50 patient cohort at 10% level, expected toxicity probability of 20%
poc_rule = calc.rule.tite(n=50,p0=0.20,alpha=0.10,type="Pocock")

# Tabulate stopping boundary
table.rule.tite(poc_rule)

## End(Not run)