Skip to contents

This function calculates the Go, NoGo, and Gray probabilities for binary outcome clinical trials using the Bayesian framework. The function evaluates operating characteristics by computing the probability of making each type of decision (Go, NoGo, or Gray) across different true response rates. The function supports controlled, uncontrolled, and external control designs.

Usage

pGNGsinglebinary(
  prob = "posterior",
  design = "controlled",
  theta.TV,
  theta.MAV,
  theta.NULL = NULL,
  gamma1,
  gamma2,
  pi1,
  pi2,
  n1,
  n2,
  a1,
  a2,
  b1,
  b2,
  z = NULL,
  m1,
  m2,
  ne1,
  ne2,
  ye1,
  ye2,
  ae1,
  ae2,
  error_if_Miss = TRUE,
  Gray_inc_Miss = FALSE
)

Arguments

prob

A character string specifying the type of probability to use for decision-making. Options are 'posterior' for posterior probability or 'predictive' for posterior predictive probability.

design

A character string specifying the type of trial design. Options are 'controlled' for randomized controlled trials, 'uncontrolled' for single-arm studies, or 'external' for designs incorporating external data.

theta.TV

A numeric value representing the target value threshold for calculating Go probability when prob = 'posterior'. This represents the minimum clinically meaningful treatment effect.

theta.MAV

A numeric value representing the minimum acceptable value threshold for calculating NoGo probability when prob = 'posterior'. This represents the futility threshold.

theta.NULL

A numeric value representing the null hypothesis threshold for calculating Go/NoGo probabilities when prob = 'predictive'.

gamma1

A numeric value in (0, 1) representing the minimum probability threshold to declare success (Go decision). Typically set to values like 0.8 or 0.9.

gamma2

A numeric value in (0, 1) representing the maximum probability threshold for declaring futility (NoGo decision). Typically set to values like 0.2 or 0.3, with gamma2 < gamma1.

pi1

A numeric value or vector representing the true response probability(s) for group 1 (treatment) under which to evaluate operating characteristics.

pi2

A numeric value or vector representing the true response probability(s) for group 2 (control) under which to evaluate operating characteristics.

n1

A positive integer representing the number of patients in group 1 for the proof-of-concept (PoC) trial.

n2

A positive integer representing the number of patients in group 2 for the PoC trial.

a1

A positive numeric value representing the first shape parameter (α) of the prior beta distribution for group 1.

a2

A positive numeric value representing the first shape parameter (α) of the prior beta distribution for group 2.

b1

A positive numeric value representing the second shape parameter (β) of the prior beta distribution for group 1.

b2

A positive numeric value representing the second shape parameter (β) of the prior beta distribution for group 2.

z

A non-negative integer representing the hypothetical observed number of responders in group 2 for an uncontrolled design (required if design = 'uncontrolled').

m1

A positive integer representing the number of patients in group 1 for the future trial (required if prob = 'predictive').

m2

A positive integer representing the number of patients in group 2 for the future trial (required if prob = 'predictive').

ne1

A positive integer representing the number of patients in group 1 for the external data (required if design = 'external').

ne2

A positive integer representing the number of patients in group 2 for the external data (required if design = 'external').

ye1

A non-negative integer representing the observed number of responders in group 1 for the external data (required if design = 'external').

ye2

A non-negative integer representing the observed number of responders in group 2 for the external data (required if design = 'external').

ae1

A numeric value in (0, 1] representing the power prior scale parameter for group 1 (required if design = 'external'). Controls the degree of borrowing: 0 = no borrowing, 1 = full borrowing.

ae2

A numeric value in (0, 1] representing the power prior scale parameter for group 2 (required if design = 'external'). Controls the degree of borrowing: 0 = no borrowing, 1 = full borrowing.

error_if_Miss

A logical value; if TRUE (default), the function stops with an error when positive Miss probability is obtained, indicating poorly chosen thresholds. If FALSE, the function proceeds and reports Miss probability based on Gray_inc_Miss setting.

Gray_inc_Miss

A logical value; if TRUE, Miss probability is included in Gray probability (Miss is not reported separately). If FALSE (default), Miss probability is reported as a separate category. This parameter is only active when error_if_Miss = FALSE.

Value

A data frame containing the true response probabilities for both groups and the corresponding Go, NoGo, and Gray probabilities. When error_if_Miss = FALSE and Gray_inc_Miss = FALSE, Miss probability is also included as a separate column.

Details

The function evaluates operating characteristics by:

  • Enumerating all possible trial outcomes (y1, y2) under the specified true response rates (pi1, pi2)

  • Computing the posterior or predictive probability for each outcome

  • Classifying each outcome as Go, NoGo, or Gray based on decision thresholds

  • Weighting each outcome by its probability under the true response rates

Decision rules:

  • Go: P(treatment effect > threshold | data) ≥ γ₁ AND P(treatment effect > threshold | data) in lower tail < γ₂

  • NoGo: P(treatment effect > threshold | data) < γ₁ AND P(treatment effect > threshold | data) in lower tail ≥ γ₂

  • Gray: Neither Go nor NoGo criteria are met (γ₂ < probability < γ₁)

  • Miss: Both Go and NoGo criteria are met simultaneously (indicates poorly chosen thresholds)

Handling Miss probability:

  • When error_if_Miss = TRUE (default): Function stops with error if Miss probability > 0, prompting reconsideration of thresholds

  • When error_if_Miss = FALSE and Gray_inc_Miss = TRUE: Miss probability is added to Gray probability

  • When error_if_Miss = FALSE and Gray_inc_Miss = FALSE: Miss probability is reported as a separate category

The function can be used for:

  • Controlled design: Two-arm randomized trial

  • Uncontrolled design: Single-arm trial with historical control

  • External design: Incorporating historical data through power priors

Examples

# Example 1: Calculate Go/NoGo/Gray probabilities using posterior probability
# for controlled design (default: error_if_Miss = TRUE)
pGNGsinglebinary(
  prob = 'posterior', design = 'controlled',
  theta.TV = 0.4, theta.MAV = 0.2, theta.NULL = NULL,
  gamma1 = 0.8, gamma2 = 0.2,
  pi1 = c(0.2, 0.4, 0.6, 0.8), pi2 = rep(0.2, 4),
  n1 = 12, n2 = 12, a1 = 0.5, a2 = 0.5, b1 = 0.5, b2 = 0.5,
  z = NULL, m1 = NULL, m2 = NULL,
  ne1 = NULL, ne2 = NULL, ye1 = NULL, ye2 = NULL, ae1 = NULL, ae2 = NULL,
  error_if_Miss = TRUE, Gray_inc_Miss = FALSE
)
#>   pi1 pi2           Go        Gray       NoGo
#> 1 0.2 0.2 0.0004067764 0.009831985 0.98976124
#> 2 0.4 0.2 0.0277220471 0.140475165 0.83180279
#> 3 0.6 0.2 0.2223529072 0.342730771 0.43491632
#> 4 0.8 0.2 0.6558924323 0.254936309 0.08917126

# Example 2: Calculate Go/NoGo/Gray probabilities using posterior predictive probability
pGNGsinglebinary(
  prob = 'predictive', design = 'controlled',
  theta.TV = NULL, theta.MAV = NULL, theta.NULL = 0,
  gamma1 = 0.9, gamma2 = 0.3,
  pi1 = c(0.2, 0.4, 0.6, 0.8), pi2 = rep(0.2, 4),
  n1 = 12, n2 = 12, a1 = 0.5, a2 = 0.5, b1 = 0.5, b2 = 0.5,
  z = NULL, m1 = 30, m2 = 30,
  ne1 = NULL, ne2 = NULL, ye1 = NULL, ye2 = NULL, ae1 = NULL, ae2 = NULL,
  error_if_Miss = TRUE, Gray_inc_Miss = FALSE
)
#>   pi1 pi2         Go       Gray        NoGo
#> 1 0.2 0.2 0.05181157 0.16723674 0.780951694
#> 2 0.4 0.2 0.31955679 0.34291483 0.337528381
#> 3 0.6 0.2 0.73018709 0.20070958 0.069103325
#> 4 0.8 0.2 0.96383294 0.03237868 0.003788378

# Example 3: Report Miss probability separately when thresholds may be suboptimal
pGNGsinglebinary(
  prob = 'posterior', design = 'controlled',
  theta.TV = 0.3, theta.MAV = 0.25, theta.NULL = NULL,
  gamma1 = 0.7, gamma2 = 0.6,
  pi1 = c(0.4, 0.6), pi2 = rep(0.3, 2),
  n1 = 10, n2 = 10, a1 = 1, a2 = 1, b1 = 1, b2 = 1,
  z = NULL, m1 = NULL, m2 = NULL,
  ne1 = NULL, ne2 = NULL, ye1 = NULL, ye2 = NULL, ae1 = NULL, ae2 = NULL,
  error_if_Miss = FALSE, Gray_inc_Miss = FALSE
)
#>   pi1 pi2         Go      Gray      NoGo Miss
#> 1 0.4 0.3 0.04690148 0.1937072 0.7593913    0
#> 2 0.6 0.3 0.24398543 0.3574158 0.3985988    0

# Example 4: Include Miss probability in Gray when error_if_Miss = FALSE
pGNGsinglebinary(
  prob = 'posterior', design = 'controlled',
  theta.TV = 0.3, theta.MAV = 0.25, theta.NULL = NULL,
  gamma1 = 0.7, gamma2 = 0.6,
  pi1 = c(0.4, 0.6), pi2 = rep(0.3, 2),
  n1 = 10, n2 = 10, a1 = 1, a2 = 1, b1 = 1, b2 = 1,
  z = NULL, m1 = NULL, m2 = NULL,
  ne1 = NULL, ne2 = NULL, ye1 = NULL, ye2 = NULL, ae1 = NULL, ae2 = NULL,
  error_if_Miss = FALSE, Gray_inc_Miss = TRUE
)
#>   pi1 pi2         Go      Gray      NoGo
#> 1 0.4 0.3 0.04690148 0.1937072 0.7593913
#> 2 0.6 0.3 0.24398543 0.3574158 0.3985988