Skip to contents

Evaluates operating characteristics (Go, NoGo, Gray probabilities) for binary-outcome clinical trials under the Bayesian framework by enumerating all possible trial outcomes. The function supports controlled, uncontrolled, and external designs.

Usage

pbayesdecisionprob1bin(
  prob = "posterior",
  design = "controlled",
  theta_TV = NULL,
  theta_MAV = NULL,
  theta_NULL = NULL,
  gamma_go,
  gamma_nogo,
  pi_t,
  pi_c = NULL,
  n_t,
  n_c,
  a_t,
  a_c,
  b_t,
  b_c,
  z = NULL,
  m_t = NULL,
  m_c = NULL,
  ne_t = NULL,
  ne_c = NULL,
  ye_t = NULL,
  ye_c = NULL,
  alpha0e_t = NULL,
  alpha0e_c = NULL,
  error_if_Miss = TRUE,
  Gray_inc_Miss = FALSE
)

Arguments

prob

A character string specifying the probability type. Must be 'posterior' or 'predictive'.

design

A character string specifying the trial design. Must be 'controlled', 'uncontrolled', or 'external'.

theta_TV

A numeric scalar giving the target value (TV) threshold used for the Go decision when prob = 'posterior'. Set to NULL when prob = 'predictive'.

theta_MAV

A numeric scalar giving the minimum acceptable value (MAV) threshold used for the NoGo decision when prob = 'posterior'. Must satisfy theta_TV > theta_MAV. Set to NULL when prob = 'predictive'.

theta_NULL

A numeric scalar giving the null hypothesis threshold used for both Go and NoGo decisions when prob = 'predictive'. Set to NULL when prob = 'posterior'.

gamma_go

A numeric scalar in (0, 1) giving the minimum posterior or predictive probability required for a Go decision.

gamma_nogo

A numeric scalar in (0, 1) giving the minimum posterior or predictive probability required for a NoGo decision. No ordering constraint on gamma_go and gamma_nogo is imposed, though their combination determines the frequency of Miss outcomes.

pi_t

A numeric value or vector giving the true response probability(s) for the treatment group used to evaluate operating characteristics. Each element must be in (0, 1).

pi_c

A numeric value or vector giving the true response probability(s) for the control group. For design = 'uncontrolled', this parameter is not used in calculations but must be supplied; it is excluded from the output. When supplied as a vector, must have the same length as pi_t.

n_t

A positive integer giving the number of patients in the treatment group in the proof-of-concept (PoC) trial.

n_c

A positive integer giving the number of patients in the control group in the PoC trial. For design = 'uncontrolled', this is the hypothetical control sample size (required for consistency with other designs).

a_t

A positive numeric scalar giving the first shape parameter (alpha) of the prior Beta distribution for the treatment group.

a_c

A positive numeric scalar giving the first shape parameter (alpha) of the prior Beta distribution for the control group.

b_t

A positive numeric scalar giving the second shape parameter (beta) of the prior Beta distribution for the treatment group.

b_c

A positive numeric scalar giving the second shape parameter (beta) of the prior Beta distribution for the control group.

z

A non-negative integer giving the hypothetical number of responders in the control group. Required when design = 'uncontrolled'; otherwise set to NULL. When used, y_c should be NULL.

m_t

A positive integer giving the number of patients in the treatment group for the future trial. Required when prob = 'predictive'; otherwise set to NULL.

m_c

A positive integer giving the number of patients in the control group for the future trial. Required when prob = 'predictive'; otherwise set to NULL.

ne_t

A positive integer giving the number of patients in the treatment group of the external data set. Required when design = 'external' and external treatment data are available; otherwise set to NULL.

ne_c

A positive integer giving the number of patients in the control group of the external data set. Required when design = 'external' and external control data are available; otherwise set to NULL.

ye_t

A non-negative integer giving the number of responders in the treatment group of the external data set. Required when design = 'external'; otherwise set to NULL.

ye_c

A non-negative integer giving the number of responders in the control group of the external data set. Required when design = 'external'; otherwise set to NULL.

alpha0e_t

A numeric scalar in (0, 1] giving the power prior weight for the treatment group. Required when design = 'external'; otherwise NULL.

alpha0e_c

A numeric scalar in (0, 1] giving the power prior weight for the control group. Required when design = 'external'; otherwise NULL.

error_if_Miss

A logical scalar; if TRUE (default), the function stops with an error if Miss probability > 0, prompting reconsideration of thresholds.

Gray_inc_Miss

A logical scalar; if TRUE, Miss probability is added to Gray probability. If FALSE (default), Miss is reported separately. Active only when error_if_Miss = FALSE.

Value

A data frame with one row per pi_t scenario and columns:

pi_t

True treatment response probability.

pi_c

True control response probability (omitted for uncontrolled design).

Go

Probability of making a Go decision.

Gray

Probability of making a Gray (inconclusive) decision.

NoGo

Probability of making a NoGo decision.

Miss

(Optional) Probability where Go and NoGo criteria are simultaneously met. Included when error_if_Miss = FALSE and Gray_inc_Miss = FALSE.

The returned object has S3 class pbayesdecisionprob1bin with an associated print method.

Details

Operating characteristics are computed by exact enumeration:

  1. All possible outcome pairs \((y_t, y_c)\) with \(y_t \in \{0,\ldots,n_t\}\) and \(y_c \in \{0,\ldots,n_c\}\) (or fixed at \(z\) for uncontrolled) are evaluated.

  2. For each pair, pbayespostpred1bin computes the posterior or predictive probability at both thresholds (TV/MAV or NULL).

  3. Outcomes are classified into Go, NoGo, Miss, or Gray:

    • Go: \(P(\mathrm{Go}) \ge \gamma_1\) AND \(P(\mathrm{NoGo}) < \gamma_2\)

    • NoGo: \(P(\mathrm{Go}) < \gamma_1\) AND \(P(\mathrm{NoGo}) \ge \gamma_2\)

    • Miss: both Go and NoGo criteria met simultaneously

    • Gray: neither Go nor NoGo criteria met

  4. Each outcome is weighted by its binomial probability under the true rates.

Examples

# Example 1: Controlled design with posterior probability
pbayesdecisionprob1bin(
  prob = 'posterior', design = 'controlled',
  theta_TV = 0.4, theta_MAV = 0.2, theta_NULL = NULL,
  gamma_go = 0.8, gamma_nogo = 0.2,
  pi_t = c(0.2, 0.4, 0.6, 0.8), pi_c = rep(0.2, 4),
  n_t = 12, n_c = 12,
  a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5,
  z = NULL, m_t = NULL, m_c = NULL,
  ne_t = NULL, ne_c = NULL, ye_t = NULL, ye_c = NULL, alpha0e_t = NULL, alpha0e_c = NULL,
  error_if_Miss = TRUE, Gray_inc_Miss = FALSE
)
#> Go/NoGo/Gray Decision Probabilities (Single Binary Endpoint) 
#> ---------------------------------------------------------------- 
#>   Probability type : posterior 
#>   Design           : controlled 
#>   Threshold(s)     : TV = 0.4, MAV = 0.2 
#>   Go  threshold    : gamma_go = 0.8 
#>   NoGo threshold   : gamma_nogo = 0.2 
#>   Sample size      : n_t = 12, n_c = 12 
#>   Prior (Beta)     : a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5 
#>   Miss handling    : error_if_Miss = TRUE, Gray_inc_Miss = FALSE 
#> ---------------------------------------------------------------- 
#>  pi_t pi_c     Go   Gray   NoGo
#>   0.2  0.2 0.0004 0.0098 0.9898
#>   0.4  0.2 0.0277 0.1405 0.8318
#>   0.6  0.2 0.2224 0.3427 0.4349
#>   0.8  0.2 0.6559 0.2549 0.0892
#> ---------------------------------------------------------------- 

# Example 2: Uncontrolled design with hypothetical control
pbayesdecisionprob1bin(
  prob = 'posterior', design = 'uncontrolled',
  theta_TV = 0.30, theta_MAV = 0.15, theta_NULL = NULL,
  gamma_go = 0.75, gamma_nogo = 0.25,
  pi_t = c(0.3, 0.5, 0.7), pi_c = NULL,
  n_t = 15, n_c = 15,
  a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5,
  z = 5, m_t = NULL, m_c = NULL,
  ne_t = NULL, ne_c = NULL, ye_t = NULL, ye_c = NULL, alpha0e_t = NULL, alpha0e_c = NULL,
  error_if_Miss = TRUE, Gray_inc_Miss = FALSE
)
#> Go/NoGo/Gray Decision Probabilities (Single Binary Endpoint) 
#> ---------------------------------------------------------------- 
#>   Probability type : posterior 
#>   Design           : uncontrolled 
#>   Threshold(s)     : TV = 0.3, MAV = 0.15 
#>   Go  threshold    : gamma_go = 0.75 
#>   NoGo threshold   : gamma_nogo = 0.25 
#>   Sample size      : n_t = 15, n_c = 15 
#>   Prior (Beta)     : a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5 
#>   Uncontrolled     : z = 5 
#>   Miss handling    : error_if_Miss = TRUE, Gray_inc_Miss = FALSE 
#> ---------------------------------------------------------------- 
#>  pi_t     Go   Gray   NoGo
#>   0.3 0.0000 0.0036 0.9963
#>   0.5 0.0176 0.1333 0.8491
#>   0.7 0.2969 0.4248 0.2784
#> ---------------------------------------------------------------- 

# Example 3: External design with 50 percent power prior borrowing
pbayesdecisionprob1bin(
  prob = 'posterior', design = 'external',
  theta_TV = 0.4, theta_MAV = 0.2, theta_NULL = NULL,
  gamma_go = 0.8, gamma_nogo = 0.2,
  pi_t = c(0.2, 0.4, 0.6, 0.8), pi_c = rep(0.2, 4),
  n_t = 12, n_c = 12,
  a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5,
  z = NULL, m_t = NULL, m_c = NULL,
  ne_t = 15, ne_c = 15, ye_t = 6, ye_c = 4, alpha0e_t = 0.5, alpha0e_c = 0.5,
  error_if_Miss = TRUE, Gray_inc_Miss = FALSE
)
#> Go/NoGo/Gray Decision Probabilities (Single Binary Endpoint) 
#> ---------------------------------------------------------------- 
#>   Probability type : posterior 
#>   Design           : external 
#>   Threshold(s)     : TV = 0.4, MAV = 0.2 
#>   Go  threshold    : gamma_go = 0.8 
#>   NoGo threshold   : gamma_nogo = 0.2 
#>   Sample size      : n_t = 12, n_c = 12 
#>   Prior (Beta)     : a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5 
#>   External data    : ne_t = 15, ne_c = 15, ye_t = 6, ye_c = 4 
#>                      alpha0e_t = 0.5, alpha0e_c = 0.5 
#>   Miss handling    : error_if_Miss = TRUE, Gray_inc_Miss = FALSE 
#> ---------------------------------------------------------------- 
#>  pi_t pi_c     Go   Gray   NoGo
#>   0.2  0.2 0.0000 0.0023 0.9977
#>   0.4  0.2 0.0003 0.0756 0.9241
#>   0.6  0.2 0.0104 0.3742 0.6154
#>   0.8  0.2 0.1145 0.6966 0.1889
#> ---------------------------------------------------------------- 

# Example 4: Posterior predictive probability for controlled design
pbayesdecisionprob1bin(
  prob = 'predictive', design = 'controlled',
  theta_TV = NULL, theta_MAV = NULL, theta_NULL = 0,
  gamma_go = 0.9, gamma_nogo = 0.3,
  pi_t = c(0.2, 0.4, 0.6, 0.8), pi_c = rep(0.2, 4),
  n_t = 12, n_c = 12,
  a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5,
  z = NULL, m_t = 30, m_c = 30,
  ne_t = NULL, ne_c = NULL, ye_t = NULL, ye_c = NULL, alpha0e_t = NULL, alpha0e_c = NULL,
  error_if_Miss = TRUE, Gray_inc_Miss = FALSE
)
#> Go/NoGo/Gray Decision Probabilities (Single Binary Endpoint) 
#> ---------------------------------------------------------------- 
#>   Probability type : predictive 
#>   Design           : controlled 
#>   Threshold(s)     : NULL = 0 
#>   Go  threshold    : gamma_go = 0.9 
#>   NoGo threshold   : gamma_nogo = 0.3 
#>   Sample size      : n_t = 12, n_c = 12 
#>   Prior (Beta-bin) : a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5 
#>   Future trial     : m_t = 30, m_c = 30 
#>   Miss handling    : error_if_Miss = TRUE, Gray_inc_Miss = FALSE 
#> ---------------------------------------------------------------- 
#>  pi_t pi_c     Go   Gray   NoGo
#>   0.2  0.2 0.0518 0.1672 0.7810
#>   0.4  0.2 0.3196 0.3429 0.3375
#>   0.6  0.2 0.7302 0.2007 0.0691
#>   0.8  0.2 0.9638 0.0324 0.0038
#> ---------------------------------------------------------------- 

# Example 5: Uncontrolled design with posterior predictive probability
pbayesdecisionprob1bin(
  prob = 'predictive', design = 'uncontrolled',
  theta_TV = NULL, theta_MAV = NULL, theta_NULL = 0,
  gamma_go = 0.75, gamma_nogo = 0.25,
  pi_t = c(0.3, 0.5, 0.7), pi_c = NULL,
  n_t = 15, n_c = 15,
  a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5,
  z = 5, m_t = 30, m_c = 30,
  ne_t = NULL, ne_c = NULL, ye_t = NULL, ye_c = NULL, alpha0e_t = NULL, alpha0e_c = NULL,
  error_if_Miss = TRUE, Gray_inc_Miss = FALSE
)
#> Go/NoGo/Gray Decision Probabilities (Single Binary Endpoint) 
#> ---------------------------------------------------------------- 
#>   Probability type : predictive 
#>   Design           : uncontrolled 
#>   Threshold(s)     : NULL = 0 
#>   Go  threshold    : gamma_go = 0.75 
#>   NoGo threshold   : gamma_nogo = 0.25 
#>   Sample size      : n_t = 15, n_c = 15 
#>   Prior (Beta-bin) : a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5 
#>   Uncontrolled     : z = 5 
#>   Future trial     : m_t = 30, m_c = 30 
#>   Miss handling    : error_if_Miss = TRUE, Gray_inc_Miss = FALSE 
#> ---------------------------------------------------------------- 
#>  pi_t     Go   Gray   NoGo
#>   0.3 0.0500 0.0000 0.9500
#>   0.5 0.5000 0.0000 0.5000
#>   0.7 0.9500 0.0000 0.0500
#> ---------------------------------------------------------------- 

# Example 6: External design with posterior predictive probability
pbayesdecisionprob1bin(
  prob = 'predictive', design = 'external',
  theta_TV = NULL, theta_MAV = NULL, theta_NULL = 0,
  gamma_go = 0.9, gamma_nogo = 0.3,
  pi_t = c(0.2, 0.4, 0.6, 0.8), pi_c = rep(0.2, 4),
  n_t = 12, n_c = 12,
  a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5,
  z = NULL, m_t = 30, m_c = 30,
  ne_t = 15, ne_c = 15, ye_t = 6, ye_c = 4, alpha0e_t = 0.5, alpha0e_c = 0.5,
  error_if_Miss = TRUE, Gray_inc_Miss = FALSE
)
#> Go/NoGo/Gray Decision Probabilities (Single Binary Endpoint) 
#> ---------------------------------------------------------------- 
#>   Probability type : predictive 
#>   Design           : external 
#>   Threshold(s)     : NULL = 0 
#>   Go  threshold    : gamma_go = 0.9 
#>   NoGo threshold   : gamma_nogo = 0.3 
#>   Sample size      : n_t = 12, n_c = 12 
#>   Prior (Beta-bin) : a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5 
#>   Future trial     : m_t = 30, m_c = 30 
#>   External data    : ne_t = 15, ne_c = 15, ye_t = 6, ye_c = 4 
#>                      alpha0e_t = 0.5, alpha0e_c = 0.5 
#>   Miss handling    : error_if_Miss = TRUE, Gray_inc_Miss = FALSE 
#> ---------------------------------------------------------------- 
#>  pi_t pi_c     Go   Gray   NoGo
#>   0.2  0.2 0.0303 0.2029 0.7668
#>   0.4  0.2 0.2296 0.4340 0.3363
#>   0.6  0.2 0.5888 0.3421 0.0691
#>   0.8  0.2 0.9115 0.0847 0.0038
#> ----------------------------------------------------------------