User Friendly Code for Stopping Rules

Table of Contents

⚠️ Make Sure You Understand the Code Before Using It ⚠️

Introduction

Overview

The old code we used for Bayesian monitoring rules was not very user-friendly. Ruizhe and I have incorporated the old code into a function that allows you to input all parameters at once, and it will produce the desired results along with interpretations.

In this post, I will demonstrate the code and provide examples of its use in various scenarios.

Outcomes of Interest

  1. For monitoring toxicity, having the response of 1 would mean the patient experience toxicity and theta means the probability of experiencing toxicity.

  2. For monitoring AE, having the response of 1 would mean the patient experience an adverse event and theta means the probability of experiencing AE.

  3. For monitoring futility, having the response of 1 would mean the patient experience a non success/response (e.g., failure to achieve pathologic complete response) and theta means the probability of having a failure event/non-response.

Function Input

  1. prior.a: the shape1 parameter for the beta prior distribution
  2. prior.b: the shape2 parameter for the beta prior distribution
  3. a.seed: the set seed for conducting simulation studies
  4. samp.size: how many participants will enroll for each trial
  5. nSim: number of simulation studies to calculate the operating characteristics
  6. check.points: at what sample sizez will the stopping criteria be checked. Examples:

for @@@checking at each enrollment from 1 to 30: check.points = seq(1,30,1)
@@@checking at every 3 patients from 20 to 26: check.points = seq(20,26,by=3)
@@@checking at three arbitrarily specified enrollment: check.points = c(15,27,30)
@@@checking once at 20: check.points = 20

  1. theta.c: beyond which rate we would consider the new drug is too toxic/too many AE/may fail.
  2. risk.vec: for what probabilities of event (toxicity/AE/non-response) are we doing simulations
  3. post.prob.cutoff: posterior probability cutoff
  4. futility: FALSE if you are monitoring AEs (default); TRUE if you are monitoring futility.

Code

BayesMonitBiBeta <- function(
    prior.a,
    prior.b,
    a.seed,
    samp.size,
    nSim,
    check.points,
    theta.c, 
    risk.vec,
    post.prob.cutoff,
    futility=FALSE
    ) {
  
  GetPosteriorParms = function(a, b, n, x) {
    c(a+x, b+n-x)
  }
  
  GetStoppingRule = function(n, a, b, ToxCutOff, StopProbCutOff, futility){
    if (futility==FALSE){
      for (i in 1:n) {
      ProbTooTox = pbeta(ToxCutOff, a+i, b+n-i, lower.tail=F) # Prob > Cutoff
      
      if (ProbTooTox >= StopProbCutOff) {
        print(paste("Probability of toxicity/AEs is too high if", i, "or more out of", n, "participants experience toxicity/AEs."),
              quote=F)
        break
      }
    }
    }
    else if (futility==TRUE){
      for (i in 1:n) {
      ProbTooTox = pbeta(ToxCutOff, a+i, b+n-i, lower.tail=F) # Prob > Cutoff
      
      if (ProbTooTox >= StopProbCutOff) {
        print(paste("Probability of no evidence of futility too high if", n-i, "or less out of", n, "participants respond."),
              quote=F)
        break
      }
    }
    }
  }
  
  PrintResults = function(risk.val, nSim, Stop, sample.size.stopped, SampleSize,
                          num.checks, check.points) {
    cat(paste("We checked for toxicity/AE/futility for", num.checks,"time(s) at total enrollments of",paste(check.points, collapse =","), " participants. \n"))
    cat(paste0("Results of ", nSim, " simulations with assumed probability of toxicity/AE/non-response = ", 
               risk.val, " are:\n"))
    cat(paste("\t", sum(Stop, na.rm=T), " out of ", nSim, " trial(s) ",
              "(", round(100*sum(Stop, na.rm=T)/sum(!is.na(Stop)), 1), 
              "%) stopped because posterior probability of toxicity/AE/non-response is too high.","\n", sep=""))
    cat(paste("\tAverage sample size when trial stopped is: ", round(mean(sample.size.stopped, na.rm=T)),
              ".\n", sep=""))
    cat(paste("\tAverage sample size of all trials: ", round(mean(SampleSize, na.rm=T)),
              ".\n", sep=""))
    cat("\tRange of sample size when trial stopped is: (min=")
    cat(paste(min(sample.size.stopped, na.rm=T), ", max=", max(sample.size.stopped, na.rm=T), ").\n", sep=""))
    cat("\n")
  }
  
  # A vector to store whether the trial is stopped during each simuation study
  Stop = rep(0, nSim)
  
  num.checks = length(check.points) # how many looks are we taking
  # nPerLook is defined as how many "new" observations we have at 
  # each look
  nPerLook = check.points - c(0,check.points[1:length(check.points)-1])
  
  nEve = matrix(NA, nrow=nSim, ncol=num.checks)
  
  # vector to store the sample size of the trial when stopped!
  sample.size.stopped <- rep(NA,nSim)
  
  # vector to store the total sample size of the trial
  SampleSize = rep(NA, nSim)
  
  # matrix storing posterior probability of experiencing the toxicity/AE/failure event
  PostProbs = matrix(NA, nrow=nSim, ncol=num.checks) 
  
  # Create a list to store the simulation study results for each
  # assumed risk in risk.vec
  res.list <- vector("list", length(risk.vec))
  
  # set the seed
  set.seed(a.seed)
  # the first look go through each risk scenario specified in the risk.vec input
  
  for (iEve in 1:length(risk.vec)) {
    
    pEve = risk.vec[iEve] # the ith cutoff for deciding whether to stop the trial 
    
    for (iSim in 1:nSim) {
      
      # Temp store the temporary number of events happened at each incremental look
      
      Temp = 0 # notice the danger of using a scalar cumulative counter!!!
      Stop[iSim] = 0
      
      for (j in 1:num.checks) {

        Temp = Temp + rbinom(1, nPerLook[j], pEve)
        nEve[iSim, j] = Temp
        SampleSize[iSim] = check.points[j]
        # what's the posterior prob params given the observed data and the prior?
        Parms = GetPosteriorParms(prior.a, prior.b, check.points[j], Temp)
        PostProbs[iSim, j] = pbeta(theta.c, Parms[1], Parms[2], lower.tail=F)
          
        if (PostProbs[iSim, j] >= post.prob.cutoff) {
          Stop[iSim] = 1
          # record the sample size when stopped
          sample.size.stopped[iSim] <- sum(nPerLook[1:j])
          break
        }
      }
    }
    # store iEve th result
    PrintResults(risk.val=risk.vec[iEve], nSim, Stop, sample.size.stopped, SampleSize, num.checks, check.points)
    res.list[[iEve]] <- data.frame(risk=risk.vec[iEve],
                                num.trials = nSim,
                                num.stopped = sum(Stop, na.rm=T),
                                prob.stopping = sum(Stop, na.rm=T)/sum(!is.na(Stop)))
  }
  print("####---Stopping Rules---####")
  for (i in check.points) {
    GetStoppingRule(i, prior.a, prior.b, theta.c, post.prob.cutoff, futility)
  }
  print("####---Numerical Results---####")
  return(res.list)
}

Sample Scenarios

Let’s using

  • beta(1.5, 5.5);
  • total sample size (N) = 30;
  • too toxic/not efficient if probability of more than 25% pts experience events of interest (AEs, no response) > 65%,

for our sample scenarios.

Continuous Monitoring Every Pts

From 1st to 33rd pts, monitoring each pt.

BayesMonitBiBeta(prior.a = 1.5,
                 prior.b = 5.5,
                 a.seed = 12345,
                 samp.size = 33,
                 nSim = 10000,
                 check.points = c(1:33),
                 theta.c = 0.25, # beyond which rate we would consider the new drug is too toxic/too many AE/may fail.
                 risk.vec = c(0.15, 0.20, 0.25, 0.30, 0.35),
                 post.prob.cutoff = 0.65,
                 futility = FALSE)
## We checked for toxicity/AE/futility for 33 time(s) at total enrollments of 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.15 are:
## 	1832 out of 10000 trial(s) (18.3%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 7.
## 	Average sample size of all trials: 28.
## 	Range of sample size when trial stopped is: (min=2, max=33).
## 
## We checked for toxicity/AE/futility for 33 time(s) at total enrollments of 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.2 are:
## 	3638 out of 10000 trial(s) (36.4%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 8.
## 	Average sample size of all trials: 24.
## 	Range of sample size when trial stopped is: (min=2, max=33).
## 
## We checked for toxicity/AE/futility for 33 time(s) at total enrollments of 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.25 are:
## 	5724 out of 10000 trial(s) (57.2%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 9.
## 	Average sample size of all trials: 20.
## 	Range of sample size when trial stopped is: (min=2, max=33).
## 
## We checked for toxicity/AE/futility for 33 time(s) at total enrollments of 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.3 are:
## 	7644 out of 10000 trial(s) (76.4%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 9.
## 	Average sample size of all trials: 15.
## 	Range of sample size when trial stopped is: (min=2, max=33).
## 
## We checked for toxicity/AE/futility for 33 time(s) at total enrollments of 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.35 are:
## 	8936 out of 10000 trial(s) (89.4%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 9.
## 	Average sample size of all trials: 11.
## 	Range of sample size when trial stopped is: (min=2, max=33).
## 
## [1] "####---Stopping Rules---####"
## [1] Probability of toxicity/AEs is too high if 2 or more out of 2 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 2 or more out of 3 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 2 or more out of 4 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 3 or more out of 5 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 3 or more out of 6 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 3 or more out of 7 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 4 or more out of 8 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 4 or more out of 9 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 4 or more out of 10 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 4 or more out of 11 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 5 or more out of 12 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 5 or more out of 13 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 5 or more out of 14 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 5 or more out of 15 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 6 or more out of 16 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 6 or more out of 17 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 6 or more out of 18 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 7 or more out of 19 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 7 or more out of 20 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 7 or more out of 21 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 7 or more out of 22 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 8 or more out of 23 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 8 or more out of 24 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 8 or more out of 25 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 8 or more out of 26 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 9 or more out of 27 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 9 or more out of 28 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 9 or more out of 29 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 9 or more out of 30 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 10 or more out of 31 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 10 or more out of 32 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 10 or more out of 33 participants experience toxicity/AEs.
## [1] "####---Numerical Results---####"
## [[1]]
##   risk num.trials num.stopped prob.stopping
## 1 0.15      10000        1832        0.1832
## 
## [[2]]
##   risk num.trials num.stopped prob.stopping
## 1  0.2      10000        3638        0.3638
## 
## [[3]]
##   risk num.trials num.stopped prob.stopping
## 1 0.25      10000        5724        0.5724
## 
## [[4]]
##   risk num.trials num.stopped prob.stopping
## 1  0.3      10000        7644        0.7644
## 
## [[5]]
##   risk num.trials num.stopped prob.stopping
## 1 0.35      10000        8936        0.8936

Single Assessment After Enrolling X Patients

Check once after enrolling 20 pts.

BayesMonitBiBeta(prior.a = 1.5,
                 prior.b = 5.5,
                 a.seed = 12345,
                 samp.size = 33,
                 nSim = 10000,
                 check.points = c(20),
                 theta.c = 0.25, # beyond which rate we would consider the new drug is too toxic/too many AE/may fail.
                 risk.vec = c(0.15, 0.20, 0.25, 0.30, 0.35),
                 post.prob.cutoff = 0.65,
                 futility = FALSE)
## We checked for toxicity/AE/futility for 1 time(s) at total enrollments of 20  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.15 are:
## 	223 out of 10000 trial(s) (2.2%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 20.
## 	Average sample size of all trials: 20.
## 	Range of sample size when trial stopped is: (min=20, max=20).
## 
## We checked for toxicity/AE/futility for 1 time(s) at total enrollments of 20  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.2 are:
## 	868 out of 10000 trial(s) (8.7%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 20.
## 	Average sample size of all trials: 20.
## 	Range of sample size when trial stopped is: (min=20, max=20).
## 
## We checked for toxicity/AE/futility for 1 time(s) at total enrollments of 20  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.25 are:
## 	2117 out of 10000 trial(s) (21.2%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 20.
## 	Average sample size of all trials: 20.
## 	Range of sample size when trial stopped is: (min=20, max=20).
## 
## We checked for toxicity/AE/futility for 1 time(s) at total enrollments of 20  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.3 are:
## 	3827 out of 10000 trial(s) (38.3%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 20.
## 	Average sample size of all trials: 20.
## 	Range of sample size when trial stopped is: (min=20, max=20).
## 
## We checked for toxicity/AE/futility for 1 time(s) at total enrollments of 20  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.35 are:
## 	5840 out of 10000 trial(s) (58.4%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 20.
## 	Average sample size of all trials: 20.
## 	Range of sample size when trial stopped is: (min=20, max=20).
## 
## [1] "####---Stopping Rules---####"
## [1] Probability of toxicity/AEs is too high if 7 or more out of 20 participants experience toxicity/AEs.
## [1] "####---Numerical Results---####"
## [[1]]
##   risk num.trials num.stopped prob.stopping
## 1 0.15      10000         223        0.0223
## 
## [[2]]
##   risk num.trials num.stopped prob.stopping
## 1  0.2      10000         868        0.0868
## 
## [[3]]
##   risk num.trials num.stopped prob.stopping
## 1 0.25      10000        2117        0.2117
## 
## [[4]]
##   risk num.trials num.stopped prob.stopping
## 1  0.3      10000        3827        0.3827
## 
## [[5]]
##   risk num.trials num.stopped prob.stopping
## 1 0.35      10000        5840         0.584

Check the futility once after enrolling 20 pts.

BayesMonitBiBeta(prior.a = 1.5,
                 prior.b = 5.5,
                 a.seed = 12345,
                 samp.size = 33,
                 nSim = 10000,
                 check.points = c(20),
                 theta.c = 0.25, # beyond which rate we would consider the new drug is too toxic/too many AE/may fail.
                 risk.vec = c(0.15, 0.20, 0.25, 0.30, 0.35),
                 post.prob.cutoff = 0.65,
                 futility = TRUE)
## We checked for toxicity/AE/futility for 1 time(s) at total enrollments of 20  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.15 are:
## 	223 out of 10000 trial(s) (2.2%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 20.
## 	Average sample size of all trials: 20.
## 	Range of sample size when trial stopped is: (min=20, max=20).
## 
## We checked for toxicity/AE/futility for 1 time(s) at total enrollments of 20  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.2 are:
## 	868 out of 10000 trial(s) (8.7%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 20.
## 	Average sample size of all trials: 20.
## 	Range of sample size when trial stopped is: (min=20, max=20).
## 
## We checked for toxicity/AE/futility for 1 time(s) at total enrollments of 20  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.25 are:
## 	2117 out of 10000 trial(s) (21.2%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 20.
## 	Average sample size of all trials: 20.
## 	Range of sample size when trial stopped is: (min=20, max=20).
## 
## We checked for toxicity/AE/futility for 1 time(s) at total enrollments of 20  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.3 are:
## 	3827 out of 10000 trial(s) (38.3%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 20.
## 	Average sample size of all trials: 20.
## 	Range of sample size when trial stopped is: (min=20, max=20).
## 
## We checked for toxicity/AE/futility for 1 time(s) at total enrollments of 20  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.35 are:
## 	5840 out of 10000 trial(s) (58.4%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 20.
## 	Average sample size of all trials: 20.
## 	Range of sample size when trial stopped is: (min=20, max=20).
## 
## [1] "####---Stopping Rules---####"
## [1] Probability of no evidence of futility too high if 13 or less out of 20 participants respond.
## [1] "####---Numerical Results---####"
## [[1]]
##   risk num.trials num.stopped prob.stopping
## 1 0.15      10000         223        0.0223
## 
## [[2]]
##   risk num.trials num.stopped prob.stopping
## 1  0.2      10000         868        0.0868
## 
## [[3]]
##   risk num.trials num.stopped prob.stopping
## 1 0.25      10000        2117        0.2117
## 
## [[4]]
##   risk num.trials num.stopped prob.stopping
## 1  0.3      10000        3827        0.3827
## 
## [[5]]
##   risk num.trials num.stopped prob.stopping
## 1 0.35      10000        5840         0.584

Initial Assessment After Enrolling X Patients, Followed by Continuous Monitoring

BayesMonitBiBeta(prior.a = 1.5,
                 prior.b = 5.5,
                 a.seed = 12345,
                 samp.size = 33,
                 nSim = 10000,
                 check.points = c(20, seq(20,33,1)),
                 theta.c = 0.25, # beyond which rate we would consider the new drug is too toxic/too many AE/may fail.
                 risk.vec = c(0.15, 0.20, 0.25, 0.30, 0.35),
                 post.prob.cutoff = 0.65,
                 futility = FALSE)
## We checked for toxicity/AE/futility for 15 time(s) at total enrollments of 20,20,21,22,23,24,25,26,27,28,29,30,31,32,33  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.15 are:
## 	499 out of 10000 trial(s) (5%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 23.
## 	Average sample size of all trials: 32.
## 	Range of sample size when trial stopped is: (min=20, max=33).
## 
## We checked for toxicity/AE/futility for 15 time(s) at total enrollments of 20,20,21,22,23,24,25,26,27,28,29,30,31,32,33  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.2 are:
## 	1928 out of 10000 trial(s) (19.3%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 23.
## 	Average sample size of all trials: 31.
## 	Range of sample size when trial stopped is: (min=20, max=33).
## 
## We checked for toxicity/AE/futility for 15 time(s) at total enrollments of 20,20,21,22,23,24,25,26,27,28,29,30,31,32,33  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.25 are:
## 	4279 out of 10000 trial(s) (42.8%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 23.
## 	Average sample size of all trials: 28.
## 	Range of sample size when trial stopped is: (min=20, max=33).
## 
## We checked for toxicity/AE/futility for 15 time(s) at total enrollments of 20,20,21,22,23,24,25,26,27,28,29,30,31,32,33  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.3 are:
## 	6602 out of 10000 trial(s) (66%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 22.
## 	Average sample size of all trials: 26.
## 	Range of sample size when trial stopped is: (min=20, max=33).
## 
## We checked for toxicity/AE/futility for 15 time(s) at total enrollments of 20,20,21,22,23,24,25,26,27,28,29,30,31,32,33  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.35 are:
## 	8424 out of 10000 trial(s) (84.2%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 22.
## 	Average sample size of all trials: 23.
## 	Range of sample size when trial stopped is: (min=20, max=33).
## 
## [1] "####---Stopping Rules---####"
## [1] Probability of toxicity/AEs is too high if 7 or more out of 20 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 7 or more out of 20 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 7 or more out of 21 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 7 or more out of 22 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 8 or more out of 23 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 8 or more out of 24 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 8 or more out of 25 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 8 or more out of 26 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 9 or more out of 27 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 9 or more out of 28 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 9 or more out of 29 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 9 or more out of 30 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 10 or more out of 31 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 10 or more out of 32 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 10 or more out of 33 participants experience toxicity/AEs.
## [1] "####---Numerical Results---####"
## [[1]]
##   risk num.trials num.stopped prob.stopping
## 1 0.15      10000         499        0.0499
## 
## [[2]]
##   risk num.trials num.stopped prob.stopping
## 1  0.2      10000        1928        0.1928
## 
## [[3]]
##   risk num.trials num.stopped prob.stopping
## 1 0.25      10000        4279        0.4279
## 
## [[4]]
##   risk num.trials num.stopped prob.stopping
## 1  0.3      10000        6602        0.6602
## 
## [[5]]
##   risk num.trials num.stopped prob.stopping
## 1 0.35      10000        8424        0.8424

Self-defined Multiple Timepoint Assessments

The distances between time points are not necessary the same.

BayesMonitBiBeta(prior.a = 1.5,
                 prior.b = 5.5,
                 a.seed = 12345,
                 samp.size = 33,
                 nSim = 10000,
                 check.points = c(10, 15, 25),
                 theta.c = 0.25, # beyond which rate we would consider the new drug is too toxic/too many AE/may fail.
                 risk.vec = c(0.15, 0.20, 0.25, 0.30, 0.35),
                 post.prob.cutoff = 0.65,
                 futility = FALSE)
## We checked for toxicity/AE/futility for 3 time(s) at total enrollments of 10,15,25  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.15 are:
## 	860 out of 10000 trial(s) (8.6%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 13.
## 	Average sample size of all trials: 24.
## 	Range of sample size when trial stopped is: (min=10, max=25).
## 
## We checked for toxicity/AE/futility for 3 time(s) at total enrollments of 10,15,25  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.2 are:
## 	2254 out of 10000 trial(s) (22.5%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 13.
## 	Average sample size of all trials: 22.
## 	Range of sample size when trial stopped is: (min=10, max=25).
## 
## We checked for toxicity/AE/futility for 3 time(s) at total enrollments of 10,15,25  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.25 are:
## 	4167 out of 10000 trial(s) (41.7%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 14.
## 	Average sample size of all trials: 20.
## 	Range of sample size when trial stopped is: (min=10, max=25).
## 
## We checked for toxicity/AE/futility for 3 time(s) at total enrollments of 10,15,25  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.3 are:
## 	6175 out of 10000 trial(s) (61.8%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 14.
## 	Average sample size of all trials: 18.
## 	Range of sample size when trial stopped is: (min=10, max=25).
## 
## We checked for toxicity/AE/futility for 3 time(s) at total enrollments of 10,15,25  participants. 
## Results of 10000 simulations with assumed probability of toxicity/AE/non-response = 0.35 are:
## 	7816 out of 10000 trial(s) (78.2%) stopped because posterior probability of toxicity/AE/non-response is too high.
## 	Average sample size when trial stopped is: 13.
## 	Average sample size of all trials: 16.
## 	Range of sample size when trial stopped is: (min=10, max=25).
## 
## [1] "####---Stopping Rules---####"
## [1] Probability of toxicity/AEs is too high if 4 or more out of 10 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 5 or more out of 15 participants experience toxicity/AEs.
## [1] Probability of toxicity/AEs is too high if 8 or more out of 25 participants experience toxicity/AEs.
## [1] "####---Numerical Results---####"
## [[1]]
##   risk num.trials num.stopped prob.stopping
## 1 0.15      10000         860         0.086
## 
## [[2]]
##   risk num.trials num.stopped prob.stopping
## 1  0.2      10000        2254        0.2254
## 
## [[3]]
##   risk num.trials num.stopped prob.stopping
## 1 0.25      10000        4167        0.4167
## 
## [[4]]
##   risk num.trials num.stopped prob.stopping
## 1  0.3      10000        6175        0.6175
## 
## [[5]]
##   risk num.trials num.stopped prob.stopping
## 1 0.35      10000        7816        0.7816