Skip to contents

This function computes the Go, NoGo, and Gray probabilities for continuous outcome clinical trials using the Bayesian framework. The function supports controlled, uncontrolled, and external control designs with multiple calculation methods including numerical integration, Monte Carlo simulation, and Welch-Satterthwaite approximation. For external control designs, power priors are incorporated using exact conjugate representation.

Usage

pGNGsinglecontinuous(
  nsim,
  prob,
  design,
  prior,
  CalcMethod,
  theta.TV,
  theta.MAV,
  theta.NULL,
  nMC = NULL,
  gamma1,
  gamma2,
  n1,
  n2,
  m1,
  m2,
  kappa01,
  kappa02,
  nu01,
  nu02,
  mu01,
  mu02,
  sigma01,
  sigma02,
  mu1,
  mu2,
  sigma1,
  sigma2,
  r = NULL,
  ne1 = NULL,
  ne2 = NULL,
  alpha01 = NULL,
  alpha02 = NULL,
  bar.ye1 = NULL,
  bar.ye2 = NULL,
  se1 = NULL,
  se2 = NULL,
  error_if_Miss = TRUE,
  Gray_inc_Miss = FALSE,
  seed
)

Arguments

nsim

A positive integer representing the number of iterations for calculating posterior/posterior predictive probability.

prob

A character string specifying the type of probability to use (prob = 'posterior' or prob = 'predictive').

design

A character string specifying the type of trial design (design = 'controlled', design = 'uncontrolled', or design = 'external').

prior

A character string specifying the prior distribution (prior = 'N-Inv-Chisq' or prior = 'vague').

CalcMethod

A character string specifying the calculation method (CalcMethod = 'NI' for numerical integration, CalcMethod = 'MC' for Monte Carlo method, or CalcMethod = 'WS' for Welch-Satterthwaite approximation).

theta.TV

A numeric value representing the pre-specified threshold value for calculating Go probability when prob = 'posterior'.

theta.MAV

A numeric value representing the pre-specified threshold value for calculating NoGo probability when prob = 'posterior'.

theta.NULL

A numeric value representing the pre-specified threshold value for calculating Go probability when prob = 'predictive'.

nMC

A positive integer representing the number of iterations for Monte Carlo simulation (required if CalcMethod = 'MC').

gamma1

A numeric value between 0 and 1 representing the minimum probability to declare success.

gamma2

A numeric value between 0 and 1 representing the futility threshold.

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.

m1

A positive integer representing the number of patients in group 1 for the future trial data.

m2

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

kappa01

A positive numeric value representing the prior precision parameter related to the mean for conjugate prior of Normal-Inverse-Chi-squared in group 1.

kappa02

A positive numeric value representing the prior precision parameter related to the mean for conjugate prior of Normal-Inverse-Chi-squared in group 2.

nu01

A positive numeric value representing the prior degrees of freedom related to the variance for conjugate prior of Normal-Inverse-Chi-squared in group 1.

nu02

A positive numeric value representing the prior degrees of freedom related to the variance for conjugate prior of Normal-Inverse-Chi-squared in group 2.

mu01

A numeric value representing the prior mean value of outcomes in group 1 for the PoC trial.

mu02

A numeric value representing the prior mean value of outcomes in group 2 for the PoC trial.

sigma01

A positive numeric value representing the prior standard deviation of the outcomes for group 1.

sigma02

A positive numeric value representing the prior standard deviation of the outcomes for group 2.

mu1

A numeric value representing the true mean of outcomes in group 1 for the PoC trial.

mu2

A numeric value representing the true mean of outcomes in group 2 for the PoC trial.

sigma1

A positive numeric value representing the true standard deviation of outcomes in group 1.

sigma2

A positive numeric value representing the true standard deviation of outcomes in group 2.

r

A positive numeric value representing the ratio of the hypothesized values for the null hypotheses (required if design = 'uncontrolled').

ne1

A positive integer representing the number of patients in group 1 for the external data (can be NULL if no external treatment data).

ne2

A positive integer representing the number of patients in group 2 for the external data (can be NULL if no external control data).

alpha01

A positive numeric value representing the scale parameter (power prior) for group 1 (required if external design, can be NULL if no external treatment data).

alpha02

A positive numeric value representing the scale parameter (power prior) for group 2 (required if external design, can be NULL if no external control data).

bar.ye1

A numeric value representing the external sample mean of group 1 (required if external treatment data available).

bar.ye2

A numeric value representing the external sample mean of group 2 (required if external control data available).

se1

A positive numeric value representing the external sample standard deviation of group 1 (required if external treatment data available).

se2

A positive numeric value representing the external sample standard deviation of group 2 (required if external control data available).

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.

seed

A numeric value representing the seed number for reproducible random number generation.

Value

A data frame containing the true means for both groups and the 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 performs Monte Carlo simulation to evaluate operating characteristics by:

  • Generating random trial data based on specified true parameters

  • Computing posterior or predictive probabilities for each simulated trial

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

For external control designs, power priors are incorporated using exact conjugate representation:

  • Power priors for normal data are mathematically equivalent to Normal-Inverse-Chi-squared distributions

  • This enables closed-form computation without MCMC sampling

  • Alpha parameters control the degree of borrowing (0 = no borrowing, 1 = full borrowing)

Decision rules:

  • Go: P(treatment effect > threshold) ≥ γ₁

  • NoGo: P(treatment effect > threshold) ≤ γ₂

  • Gray: γ₂ < P(treatment effect > threshold) < γ₁

  • 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

Examples

# Example 1: Controlled design with vague prior and NI method
# (default: error_if_Miss = TRUE, Gray_inc_Miss = FALSE)
pGNGsinglecontinuous(
  nsim = 100, prob = 'posterior', design = 'controlled', prior = 'vague', CalcMethod = 'NI',
  theta.TV = 1.5, theta.MAV = -0.5, theta.NULL = NULL,
  nMC = NULL, gamma1 = 0.7, gamma2 = 0.2,
  n1 = 15, n2 = 15, m1 = NULL, m2 = NULL,
  kappa01 = NULL, kappa02 = NULL, nu01 = NULL, nu02 = NULL,
  mu01 = NULL, mu02 = NULL, sigma01 = NULL, sigma02 = NULL,
  mu1 = 3, mu2 = 1, sigma1 = 1.2, sigma2 = 1.1,
  r = NULL, ne1 = NULL, ne2 = NULL, alpha01 = NULL, alpha02 = NULL,
  bar.ye1 = NULL, bar.ye2 = NULL, se1 = NULL, se2 = NULL,
  error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 2
)
#>   mu1 mu2   Go Gray NoGo
#> 1   3   1 0.73 0.27    0

# Example 2: External design with control data using WS approximation
if (FALSE) { # \dontrun{
pGNGsinglecontinuous(
  nsim = 100, prob = 'posterior', design = 'external', prior = 'vague', CalcMethod = 'WS',
  theta.TV = 1.0, theta.MAV = 0.0, theta.NULL = NULL,
  nMC = NULL, gamma1 = 0.8, gamma2 = 0.2,
  n1 = 12, n2 = 12, m1 = NULL, m2 = NULL,
  kappa01 = NULL, kappa02 = NULL, nu01 = NULL, nu02 = NULL,
  mu01 = NULL, mu02 = NULL, sigma01 = NULL, sigma02 = NULL,
  mu1 = 2, mu2 = 0, sigma1 = 1, sigma2 = 1,
  r = NULL, ne1 = NULL, ne2 = 20, alpha01 = NULL, alpha02 = 0.5,
  bar.ye1 = NULL, bar.ye2 = 0, se1 = NULL, se2 = 1,
  error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 4
)
} # }

# Example 3: Controlled design with predictive probability
pGNGsinglecontinuous(
  nsim = 100, prob = 'predictive', design = 'controlled', prior = 'N-Inv-Chisq', CalcMethod = 'NI',
  theta.TV = NULL, theta.MAV = NULL, theta.NULL = 2.0,
  nMC = NULL, gamma1 = 0.75, gamma2 = 0.35,
  n1 = 15, n2 = 15, m1 = 50, m2 = 50,
  kappa01 = 3, kappa02 = 3, nu01 = 4, nu02 = 4,
  mu01 = 3.5, mu02 = 1.5, sigma01 = 1.5, sigma02 = 1.5,
  mu1 = 3.2, mu2 = 1.3, sigma1 = 1.4, sigma2 = 1.2,
  r = NULL, ne1 = NULL, ne2 = NULL, alpha01 = NULL, alpha02 = NULL,
  bar.ye1 = NULL, bar.ye2 = NULL, se1 = NULL, se2 = NULL,
  error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 3
)
#>   mu1 mu2   Go Gray NoGo
#> 1 3.2 1.3 0.04 0.13 0.83

# Example 4: External design with predictive probability using MC method
if (FALSE) { # \dontrun{
pGNGsinglecontinuous(
  nsim = 100, prob = 'predictive', design = 'external', prior = 'vague', CalcMethod = 'MC',
  theta.TV = NULL, theta.MAV = NULL, theta.NULL = 1.5,
  nMC = 5000, gamma1 = 0.7, gamma2 = 0.4,
  n1 = 12, n2 = 12, m1 = 30, m2 = 30,
  kappa01 = NULL, kappa02 = NULL, nu01 = NULL, nu02 = NULL,
  mu01 = NULL, mu02 = NULL, sigma01 = NULL, sigma02 = NULL,
  mu1 = 2.5, mu2 = 1.0, sigma1 = 1.3, sigma2 = 1.1,
  r = NULL, ne1 = 15, ne2 = 18, alpha01 = 0.6, alpha02 = 0.7,
  bar.ye1 = 2.3, bar.ye2 = 0.9, se1 = 1.2, se2 = 1.0,
  error_if_Miss = FALSE, Gray_inc_Miss = FALSE, seed = 5
)
} # }

# Example 5: Report Miss probability separately when thresholds may be suboptimal
pGNGsinglecontinuous(
  nsim = 100, prob = 'posterior', design = 'controlled', prior = 'vague', CalcMethod = 'NI',
  theta.TV = 1.0, theta.MAV = 0.8, theta.NULL = NULL,
  nMC = NULL, gamma1 = 0.65, gamma2 = 0.55,
  n1 = 10, n2 = 10, m1 = NULL, m2 = NULL,
  kappa01 = NULL, kappa02 = NULL, nu01 = NULL, nu02 = NULL,
  mu01 = NULL, mu02 = NULL, sigma01 = NULL, sigma02 = NULL,
  mu1 = 2.5, mu2 = 1.5, sigma1 = 1.0, sigma2 = 1.0,
  r = NULL, ne1 = NULL, ne2 = NULL, alpha01 = NULL, alpha02 = NULL,
  bar.ye1 = NULL, bar.ye2 = NULL, se1 = NULL, se2 = NULL,
  error_if_Miss = FALSE, Gray_inc_Miss = FALSE, seed = 6
)
#>   mu1 mu2   Go Gray NoGo Miss
#> 1 2.5 1.5 0.25 0.48 0.27    0

# Example 6: Include Miss probability in Gray when error_if_Miss = FALSE
pGNGsinglecontinuous(
  nsim = 100, prob = 'posterior', design = 'controlled', prior = 'vague', CalcMethod = 'NI',
  theta.TV = 1.0, theta.MAV = 0.8, theta.NULL = NULL,
  nMC = NULL, gamma1 = 0.65, gamma2 = 0.55,
  n1 = 10, n2 = 10, m1 = NULL, m2 = NULL,
  kappa01 = NULL, kappa02 = NULL, nu01 = NULL, nu02 = NULL,
  mu01 = NULL, mu02 = NULL, sigma01 = NULL, sigma02 = NULL,
  mu1 = 2.5, mu2 = 1.5, sigma1 = 1.0, sigma2 = 1.0,
  r = NULL, ne1 = NULL, ne2 = NULL, alpha01 = NULL, alpha02 = NULL,
  bar.ye1 = NULL, bar.ye2 = NULL, se1 = NULL, se2 = NULL,
  error_if_Miss = FALSE, Gray_inc_Miss = TRUE, seed = 7
)
#>   mu1 mu2   Go Gray NoGo
#> 1 2.5 1.5 0.34 0.38 0.28