Skip to contents

Evaluates Go/NoGo/Gray decision probabilities for a single continuous endpoint via Monte Carlo simulation. Supports controlled (parallel control), uncontrolled (single-arm with informative priors), and external (power prior borrowing) designs with both posterior and predictive probability approaches.

Usage

pbayesdecisionprob1cont(
  nsim,
  prob,
  design,
  prior,
  CalcMethod,
  theta_TV = NULL,
  theta_MAV = NULL,
  theta_NULL = NULL,
  nMC = NULL,
  gamma_go,
  gamma_nogo,
  n_t,
  n_c = NULL,
  m_t = NULL,
  m_c = NULL,
  kappa0_t = NULL,
  kappa0_c = NULL,
  nu0_t = NULL,
  nu0_c = NULL,
  mu0_t = NULL,
  mu0_c = NULL,
  sigma0_t = NULL,
  sigma0_c = NULL,
  mu_t,
  mu_c = NULL,
  sigma_t,
  sigma_c = NULL,
  r = NULL,
  ne_t = NULL,
  ne_c = NULL,
  alpha0e_t = NULL,
  alpha0e_c = NULL,
  bar_ye_t = NULL,
  bar_ye_c = NULL,
  se_t = NULL,
  se_c = NULL,
  error_if_Miss = TRUE,
  Gray_inc_Miss = FALSE,
  seed
)

Arguments

nsim

A positive integer specifying the number of Monte Carlo simulation replicates.

prob

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

design

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

prior

A character string specifying the prior distribution: 'vague' or 'N-Inv-Chisq'.

CalcMethod

A character string specifying the computation method: 'NI' (Numerical Integration), 'MC' (Monte Carlo), or 'MM' (Moment Matching).

theta_TV

A numeric value representing the target value (TV) threshold for the Go decision. Required if prob = 'posterior'; otherwise NULL. Default is NULL.

theta_MAV

A numeric value representing the minimum acceptable value (MAV) threshold for the NoGo decision. Required if prob = 'posterior'; otherwise NULL. Default is NULL.

theta_NULL

A numeric value representing the null hypothesis threshold. Required if prob = 'predictive'; otherwise NULL. Default is NULL.

nMC

A positive integer specifying the number of Monte Carlo draws for computing posterior probabilities. Required if CalcMethod = 'MC'; otherwise NULL.

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.

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 proof-of-concept (PoC) trial. Required for design = 'controlled' or 'external'; set to NULL for design = 'uncontrolled'.

m_t

A positive integer representing the future sample size for the treatment group. Required if prob = 'predictive'; otherwise NULL. Default is NULL.

m_c

A positive integer representing the future sample size for the control group. Required if prob = 'predictive'; otherwise NULL. Default is NULL.

kappa0_t

A positive numeric value representing the prior hyperparameter kappa for the treatment group. Required if prior = 'N-Inv-Chisq'; otherwise NULL. Default is NULL.

kappa0_c

A positive numeric value representing the prior hyperparameter kappa for the control group. Required if prior = 'N-Inv-Chisq' and design %in% c('controlled', 'external'); otherwise NULL. Default is NULL.

nu0_t

A positive numeric value representing the prior hyperparameter nu for the treatment group. Required if prior = 'N-Inv-Chisq'; otherwise NULL. Default is NULL.

nu0_c

A positive numeric value representing the prior hyperparameter nu for the control group. Required if prior = 'N-Inv-Chisq' and design %in% c('controlled', 'external'); otherwise NULL. Default is NULL.

mu0_t

A numeric value representing the prior mean for the treatment group. Required if prior = 'N-Inv-Chisq'; otherwise NULL. Default is NULL.

mu0_c

A numeric value representing the prior mean for the control group. For design = 'uncontrolled', this represents the hypothetical control mean. Required if prior = 'N-Inv-Chisq' and design %in% c('controlled', 'external'), or if design = 'uncontrolled'; otherwise NULL. Default is NULL.

sigma0_t

A positive numeric value representing the prior standard deviation for the treatment group. Required if prior = 'N-Inv-Chisq'; otherwise NULL. Default is NULL.

sigma0_c

A positive numeric value representing the prior standard deviation for the control group. Required if prior = 'N-Inv-Chisq' and design %in% c('controlled', 'external'); otherwise NULL. Default is NULL.

mu_t

A numeric value representing the true mean for the treatment group in the simulation.

mu_c

A numeric value representing the true mean for the control group in the simulation. For uncontrolled design, this represents the historical control mean. Set to NULL if design = 'uncontrolled'.

sigma_t

A positive numeric value representing the true standard deviation for the treatment group in the simulation.

sigma_c

A positive numeric value representing the true standard deviation for the control group in the simulation. For uncontrolled design, this represents the historical control standard deviation. Set to NULL if design = 'uncontrolled'.

r

A positive numeric value representing the variance scaling factor that allows the scale of hypothetical control to be different from treatment. Specifically, sd.control = sqrt(r) * sd.treatment. Required if design = 'uncontrolled'. When r = 1, the control and treatment have the same variance scale.

ne_t

A positive integer representing the number of patients in the treatment group for the external data. Required if design = 'external' and external treatment data are available.

ne_c

A positive integer representing the number of patients in the control group for the external data. Required if design = 'external' and external control data are available.

alpha0e_t

A numeric value in (0, 1] representing the power prior scale parameter for the treatment group. Controls the degree of borrowing from external treatment data: 0 = no borrowing, 1 = full borrowing. Required if ne_t is specified.

alpha0e_c

A numeric value in (0, 1] representing the power prior scale parameter for the control group. Controls the degree of borrowing from external control data: 0 = no borrowing, 1 = full borrowing. Required if ne_c is specified.

bar_ye_t

A numeric value representing the sample mean of the external data for the treatment group. Required if ne_t is specified.

bar_ye_c

A numeric value representing the sample mean of the external data for the control group. Required if ne_c is specified.

se_t

A positive numeric value representing the sample standard deviation of the external data for the treatment group. Required if ne_t is specified.

se_c

A positive numeric value representing the sample standard deviation of the external data for the control group. Required if ne_c is specified.

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. For uncontrolled design, only mu_t is included (not mu_c).

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

Posterior parameter calculations (mu.t1, mu.t2, sd.t1, sd.t2, nu.t1, nu.t2) are fully vectorized over the nsim simulated datasets. pbayespostpred1cont is called twice (once per threshold), with each call receiving vectors of length nsim and returning a vector of nsim probabilities - no inner loop over simulation replicates is required.

For external 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: gGo >= gamma_go and gNoGo < gamma_nogo

  • NoGo: gGo < gamma_go and gNoGo >= gamma_nogo

  • Gray: neither Go nor NoGo criterion is met

  • Miss: both Go and NoGo criteria are met simultaneously

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 informative priors (historical control)

  • External design: Incorporating historical data through power priors

Examples

# Example 1: Controlled design with vague prior and NI method
# (default: error_if_Miss = TRUE, Gray_inc_Miss = FALSE)
pbayesdecisionprob1cont(
  nsim = 100, prob = 'posterior', design = 'controlled', prior = 'vague', CalcMethod = 'NI',
  theta_TV = 1.5, theta_MAV = -0.5, theta_NULL = NULL,
  nMC = NULL, gamma_go = 0.7, gamma_nogo = 0.2,
  n_t = 15, n_c = 15, m_t = NULL, m_c = NULL,
  kappa0_t = NULL, kappa0_c = NULL, nu0_t = NULL, nu0_c = NULL,
  mu0_t = NULL, mu0_c = NULL, sigma0_t = NULL, sigma0_c = NULL,
  mu_t = 3, mu_c = 1, sigma_t = 1.2, sigma_c = 1.1,
  r = NULL, ne_t = NULL, ne_c = NULL, alpha0e_t = NULL, alpha0e_c = NULL,
  bar_ye_t = NULL, bar_ye_c = NULL, se_t = NULL, se_c = NULL,
  error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 2
)
#> Go/NoGo/Gray Decision Probabilities (Single Continuous Endpoint) 
#> ---------------------------------------------------------------- 
#>   Probability type : posterior 
#>   Design           : controlled 
#>   Prior            : vague 
#>   Calc method      : NI 
#>   Simulations      : nsim = 100 
#>   Threshold(s)     : TV = 1.5, MAV = -0.5 
#>   Go  threshold    : gamma_go = 0.7 
#>   NoGo threshold   : gamma_nogo = 0.2 
#>   Sample size      : n_t = 15, n_c = 15 
#>   True SD          : sigma_t = 1.2, sigma_c = 1.1 
#>   Miss handling    : error_if_Miss = TRUE, Gray_inc_Miss = FALSE 
#>   Seed             : 2 
#> ---------------------------------------------------------------- 
#>  mu_t mu_c   Go Gray NoGo
#>     3    1 0.73 0.27    0
#> ---------------------------------------------------------------- 

# Example 2: Uncontrolled design with informative prior
pbayesdecisionprob1cont(
  nsim = 100, prob = 'posterior', design = 'uncontrolled', prior = 'N-Inv-Chisq', CalcMethod = 'NI',
  theta_TV = 1.0, theta_MAV = 0.0, theta_NULL = NULL,
  nMC = NULL, gamma_go = 0.8, gamma_nogo = 0.2,
  n_t = 20, n_c = NULL, m_t = NULL, m_c = NULL,
  kappa0_t = 2, kappa0_c = NULL, nu0_t = 5, nu0_c = NULL,
  mu0_t = 3.0, mu0_c = 1.5, sigma0_t = 1.5, sigma0_c = NULL,
  mu_t = 3.5, mu_c = NULL, sigma_t = 1.3, sigma_c = NULL,
  r = 1, ne_t = NULL, ne_c = NULL, alpha0e_t = NULL, alpha0e_c = NULL,
  bar_ye_t = NULL, bar_ye_c = NULL, se_t = NULL, se_c = NULL,
  error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 3
)
#> Go/NoGo/Gray Decision Probabilities (Single Continuous Endpoint) 
#> -------------------------------------------------------------------------------- 
#>   Probability type : posterior 
#>   Design           : uncontrolled 
#>   Prior            : N-Inv-Chisq 
#>   Calc method      : NI 
#>   Simulations      : nsim = 100 
#>   Threshold(s)     : TV = 1, MAV = 0 
#>   Go  threshold    : gamma_go = 0.8 
#>   NoGo threshold   : gamma_nogo = 0.2 
#>   Sample size      : n_t = 20, n_c = NULL 
#>   True SD          : sigma_t = 1.3, sigma_c = NULL 
#>   Variance ratio   : r = 1 
#>   Prior (treatment): kappa0_t = 2, nu0_t = 5, mu0_t = 3, sigma0_t = 1.5 
#>   Prior (control)  : kappa0_c = NULL, nu0_c = NULL, mu0_c = 1.5, sigma0_c = NULL 
#>   Miss handling    : error_if_Miss = TRUE, Gray_inc_Miss = FALSE 
#>   Seed             : 3 
#> -------------------------------------------------------------------------------- 
#>  mu_t Go Gray NoGo
#>   3.5  1    0    0
#> -------------------------------------------------------------------------------- 

# Example 3: External design with control data using MM approximation
pbayesdecisionprob1cont(
  nsim = 100, prob = 'posterior', design = 'external', prior = 'vague', CalcMethod = 'MM',
  theta_TV = 1.0, theta_MAV = 0.0, theta_NULL = NULL,
  nMC = NULL, gamma_go = 0.8, gamma_nogo = 0.2,
  n_t = 12, n_c = 12, m_t = NULL, m_c = NULL,
  kappa0_t = NULL, kappa0_c = NULL, nu0_t = NULL, nu0_c = NULL,
  mu0_t = NULL, mu0_c = NULL, sigma0_t = NULL, sigma0_c = NULL,
  mu_t = 2, mu_c = 0, sigma_t = 1, sigma_c = 1,
  r = NULL, ne_t = NULL, ne_c = 20, alpha0e_t = NULL, alpha0e_c = 0.5,
  bar_ye_t = NULL, bar_ye_c = 0, se_t = NULL, se_c = 1,
  error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 4
)
#> Go/NoGo/Gray Decision Probabilities (Single Continuous Endpoint) 
#> -------------------------------------------------------------------------------- 
#>   Probability type : posterior 
#>   Design           : external 
#>   Prior            : vague 
#>   Calc method      : MM 
#>   Simulations      : nsim = 100 
#>   Threshold(s)     : TV = 1, MAV = 0 
#>   Go  threshold    : gamma_go = 0.8 
#>   NoGo threshold   : gamma_nogo = 0.2 
#>   Sample size      : n_t = 12, n_c = 12 
#>   True SD          : sigma_t = 1, sigma_c = 1 
#>   External (treat.): ne_t = NULL, alpha0e_t = NULL, bar_ye_t = NULL, se_t = NULL 
#>   External (cont.) : ne_c = 20, alpha0e_c = 0.5, bar_ye_c = 0, se_c = 1 
#>   Miss handling    : error_if_Miss = TRUE, Gray_inc_Miss = FALSE 
#>   Seed             : 4 
#> -------------------------------------------------------------------------------- 
#>  mu_t mu_c   Go Gray NoGo
#>     2    0 0.97 0.03    0
#> -------------------------------------------------------------------------------- 

# Example 4: Controlled design with predictive probability
pbayesdecisionprob1cont(
  nsim = 100, prob = 'predictive', design = 'controlled', prior = 'N-Inv-Chisq', CalcMethod = 'NI',
  theta_TV = NULL, theta_MAV = NULL, theta_NULL = 2.0,
  nMC = NULL, gamma_go = 0.75, gamma_nogo = 0.35,
  n_t = 15, n_c = 15, m_t = 50, m_c = 50,
  kappa0_t = 3, kappa0_c = 3, nu0_t = 4, nu0_c = 4,
  mu0_t = 3.5, mu0_c = 1.5, sigma0_t = 1.5, sigma0_c = 1.5,
  mu_t = 3.2, mu_c = 1.3, sigma_t = 1.4, sigma_c = 1.2,
  r = NULL, ne_t = NULL, ne_c = NULL, alpha0e_t = NULL, alpha0e_c = NULL,
  bar_ye_t = NULL, bar_ye_c = NULL, se_t = NULL, se_c = NULL,
  error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 5
)
#> Go/NoGo/Gray Decision Probabilities (Single Continuous Endpoint) 
#> ------------------------------------------------------------------------- 
#>   Probability type : predictive 
#>   Design           : controlled 
#>   Prior            : N-Inv-Chisq 
#>   Calc method      : NI 
#>   Simulations      : nsim = 100 
#>   Threshold(s)     : NULL = 2 
#>   Go  threshold    : gamma_go = 0.75 
#>   NoGo threshold   : gamma_nogo = 0.35 
#>   Sample size      : n_t = 15, n_c = 15 
#>   True SD          : sigma_t = 1.4, sigma_c = 1.2 
#>   Future size      : m_t = 50, m_c = 50 
#>   Prior (treatment): kappa0_t = 3, nu0_t = 4, mu0_t = 3.5, sigma0_t = 1.5 
#>   Prior (control)  : kappa0_c = 3, nu0_c = 4, mu0_c = 1.5, sigma0_c = 1.5 
#>   Miss handling    : error_if_Miss = TRUE, Gray_inc_Miss = FALSE 
#>   Seed             : 5 
#> ------------------------------------------------------------------------- 
#>  mu_t mu_c   Go Gray NoGo
#>   3.2  1.3 0.24 0.06  0.7
#> ------------------------------------------------------------------------- 

# Example 5: Uncontrolled design with predictive probability
pbayesdecisionprob1cont(
  nsim = 100, prob = 'predictive', design = 'uncontrolled', prior = 'vague', CalcMethod = 'NI',
  theta_TV = NULL, theta_MAV = NULL, theta_NULL = 1.0,
  nMC = NULL, gamma_go = 0.75, gamma_nogo = 0.35,
  n_t = 20, n_c = NULL, m_t = 40, m_c = 40,
  kappa0_t = NULL, kappa0_c = NULL, nu0_t = NULL, nu0_c = NULL,
  mu0_t = NULL, mu0_c = 1.5, sigma0_t = NULL, sigma0_c = NULL,
  mu_t = 3, mu_c = NULL, sigma_t = 1.3, sigma_c = NULL,
  r = 1, ne_t = NULL, ne_c = NULL, alpha0e_t = NULL, alpha0e_c = NULL,
  bar_ye_t = NULL, bar_ye_c = NULL, se_t = NULL, se_c = NULL,
  error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 9
)
#> Go/NoGo/Gray Decision Probabilities (Single Continuous Endpoint) 
#> ---------------------------------------------------------------- 
#>   Probability type : predictive 
#>   Design           : uncontrolled 
#>   Prior            : vague 
#>   Calc method      : NI 
#>   Simulations      : nsim = 100 
#>   Threshold(s)     : NULL = 1 
#>   Go  threshold    : gamma_go = 0.75 
#>   NoGo threshold   : gamma_nogo = 0.35 
#>   Sample size      : n_t = 20, n_c = NULL 
#>   True SD          : sigma_t = 1.3, sigma_c = NULL 
#>   Variance ratio   : r = 1 
#>   Future size      : m_t = 40, m_c = 40 
#>   Miss handling    : error_if_Miss = TRUE, Gray_inc_Miss = FALSE 
#>   Seed             : 9 
#> ---------------------------------------------------------------- 
#>  mu_t   Go Gray NoGo
#>     3 0.84 0.05 0.11
#> ---------------------------------------------------------------- 

# Example 6: External design with predictive probability using MC method
pbayesdecisionprob1cont(
  nsim = 100, prob = 'predictive', design = 'external', prior = 'vague', CalcMethod = 'MC',
  theta_TV = NULL, theta_MAV = NULL, theta_NULL = 1.5,
  nMC = 5000, gamma_go = 0.7, gamma_nogo = 0.4,
  n_t = 12, n_c = 12, m_t = 30, m_c = 30,
  kappa0_t = NULL, kappa0_c = NULL, nu0_t = NULL, nu0_c = NULL,
  mu0_t = NULL, mu0_c = NULL, sigma0_t = NULL, sigma0_c = NULL,
  mu_t = 2.5, mu_c = 1.0, sigma_t = 1.3, sigma_c = 1.1,
  r = NULL, ne_t = 15, ne_c = 18, alpha0e_t = 0.6, alpha0e_c = 0.7,
  bar_ye_t = 2.3, bar_ye_c = 0.9, se_t = 1.2, se_c = 1.0,
  error_if_Miss = FALSE, Gray_inc_Miss = FALSE, seed = 6
)
#> Go/NoGo/Gray Decision Probabilities (Single Continuous Endpoint) 
#> --------------------------------------------------------------------------- 
#>   Probability type : predictive 
#>   Design           : external 
#>   Prior            : vague 
#>   Calc method      : MC 
#>   Simulations      : nsim = 100 
#>   MC draws         : nMC = 5000 
#>   Threshold(s)     : NULL = 1.5 
#>   Go  threshold    : gamma_go = 0.7 
#>   NoGo threshold   : gamma_nogo = 0.4 
#>   Sample size      : n_t = 12, n_c = 12 
#>   True SD          : sigma_t = 1.3, sigma_c = 1.1 
#>   Future size      : m_t = 30, m_c = 30 
#>   External (treat.): ne_t = 15, alpha0e_t = 0.6, bar_ye_t = 2.3, se_t = 1.2 
#>   External (cont.) : ne_c = 18, alpha0e_c = 0.7, bar_ye_c = 0.9, se_c = 1 
#>   Miss handling    : error_if_Miss = FALSE, Gray_inc_Miss = FALSE 
#>   Seed             : 6 
#> --------------------------------------------------------------------------- 
#>  mu_t mu_c   Go Gray NoGo Miss
#>   2.5    1 0.21 0.12 0.67    0
#> ---------------------------------------------------------------------------