pbayesdecisionprob1bin: Go/NoGo/Gray Decision Probabilities for a Clinical Trial with...

View source: R/pbayesdecisionprob1bin.R

pbayesdecisionprob1binR Documentation

Go/NoGo/Gray Decision Probabilities for a Clinical Trial with a Single Binary Endpoint

Description

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.

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.

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.

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
)

# 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
)

# 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
)

# 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
)

# 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
)

# 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
)


BayesianQDM documentation built on April 22, 2026, 1:09 a.m.