getgamma1cont: Find Optimal Go/NoGo Thresholds for a Single Continuous...

View source: R/getgamma1cont.R

getgamma1contR Documentation

Find Optimal Go/NoGo Thresholds for a Single Continuous Endpoint

Description

Computes the optimal Go threshold \gamma_{\mathrm{go}} and NoGo threshold \gamma_{\mathrm{nogo}} for a single continuous endpoint by searching over a grid of candidate values. The two thresholds are calibrated independently under separate scenarios:

  • \gamma_{\mathrm{go}} is the smallest value in gamma_grid such that the marginal Go probability \Pr(g_{\mathrm{Go}} \ge \gamma_{\mathrm{go}}) is strictly less than target_go under the Go-calibration scenario (mu_t_go, mu_c_go, sigma_t_go, sigma_c_go); typically the Null scenario.

  • \gamma_{\mathrm{nogo}} is the smallest value in gamma_grid such that the marginal NoGo probability \Pr(g_{\mathrm{NoGo}} \ge \gamma_{\mathrm{nogo}}) is strictly less than target_nogo under the NoGo-calibration scenario (mu_t_nogo, mu_c_nogo, sigma_t_nogo, sigma_c_nogo); typically the Alternative scenario.

Here g_{\mathrm{Go}} = P(\theta > \theta_{\mathrm{TV}} \mid \bar{y}_t, s_t, \bar{y}_c, s_c) and g_{\mathrm{NoGo}} = P(\theta \le \theta_{\mathrm{MAV}} \mid \bar{y}_t, s_t, \bar{y}_c, s_c) for prob = 'posterior', consistent with the decision rule in pbayesdecisionprob1cont.

Usage

getgamma1cont(
  nsim,
  prob = "posterior",
  design = "controlled",
  prior = "vague",
  CalcMethod = "NI",
  theta_TV = NULL,
  theta_MAV = NULL,
  theta_NULL = NULL,
  nMC = NULL,
  mu_t_go,
  mu_c_go = NULL,
  sigma_t_go,
  sigma_c_go = NULL,
  mu_t_nogo,
  mu_c_nogo = NULL,
  sigma_t_nogo,
  sigma_c_nogo = NULL,
  target_go,
  target_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,
  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,
  gamma_grid = seq(0.01, 0.99, by = 0.01),
  seed
)

Arguments

nsim

A positive integer giving the number of Monte Carlo simulation replicates used to approximate the operating characteristics.

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'.

prior

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

CalcMethod

A character string specifying the computation method for pbayespostpred1cont. Must be 'NI', 'MC', or 'MM'.

theta_TV

A numeric scalar giving the Target Value (TV) threshold for the treatment effect. Required when prob = 'posterior'; set to NULL otherwise.

theta_MAV

A numeric scalar giving the Minimum Acceptable Value (MAV) threshold. Must satisfy theta_TV > theta_MAV. Required when prob = 'posterior'; set to NULL otherwise.

theta_NULL

A numeric scalar giving the null hypothesis threshold for the predictive probability. Required when prob = 'predictive'; set to NULL otherwise.

nMC

A positive integer giving the number of inner Monte Carlo draws passed to pbayespostpred1cont. Required when CalcMethod = 'MC'; set to NULL otherwise.

mu_t_go

A numeric scalar giving the true mean for the treatment group under the Go-calibration scenario (typically Null).

mu_c_go

A numeric scalar giving the true mean for the control group under the Go-calibration scenario. Set to NULL for design = 'uncontrolled'.

sigma_t_go

A positive numeric scalar giving the true standard deviation for the treatment group under the Go-calibration scenario.

sigma_c_go

A positive numeric scalar giving the true standard deviation for the control group under the Go-calibration scenario. Set to NULL for design = 'uncontrolled'.

mu_t_nogo

A numeric scalar giving the true mean for the treatment group under the NoGo-calibration scenario (typically Alternative).

mu_c_nogo

A numeric scalar giving the true mean for the control group under the NoGo-calibration scenario. Set to NULL for design = 'uncontrolled'.

sigma_t_nogo

A positive numeric scalar giving the true standard deviation for the treatment group under the NoGo-calibration scenario.

sigma_c_nogo

A positive numeric scalar giving the true standard deviation for the control group under the NoGo-calibration scenario. Set to NULL for design = 'uncontrolled'.

target_go

A numeric scalar in (0, 1) giving the upper bound on the marginal Go probability under the Go-calibration scenario. The optimal \gamma_{\mathrm{go}} is the smallest grid value satisfying \Pr(\mathrm{Go}) < \code{target\_go}.

target_nogo

A numeric scalar in (0, 1) giving the upper bound on the marginal NoGo probability under the NoGo-calibration scenario. The optimal \gamma_{\mathrm{nogo}} is the smallest grid value satisfying \Pr(\mathrm{NoGo}) < \code{target\_nogo}.

n_t

A positive integer giving the number of patients in the treatment group in the PoC trial.

n_c

A positive integer giving the number of patients in the control group in the PoC trial. Required for design = 'controlled' or 'external'; set to NULL for design = 'uncontrolled'.

m_t

A positive integer giving the future sample size for the treatment group. Required when prob = 'predictive'; set to NULL otherwise.

m_c

A positive integer giving the future sample size for the control group. Required when prob = 'predictive'; set to NULL otherwise.

kappa0_t

A positive numeric scalar giving the prior precision parameter for the treatment group under the N-Inv-Chi-squared prior. Required when prior = 'N-Inv-Chisq'; set to NULL otherwise.

kappa0_c

A positive numeric scalar giving the prior precision parameter for the control group. Required when prior = 'N-Inv-Chisq' and design != 'uncontrolled'; set to NULL otherwise.

nu0_t

A positive numeric scalar giving the prior degrees of freedom for the treatment group under the N-Inv-Chi-squared prior. Required when prior = 'N-Inv-Chisq'; set to NULL otherwise.

nu0_c

A positive numeric scalar giving the prior degrees of freedom for the control group. Required when prior = 'N-Inv-Chisq' and design != 'uncontrolled'; set to NULL otherwise.

mu0_t

A numeric scalar giving the prior mean for the treatment group under the N-Inv-Chi-squared prior. Required when prior = 'N-Inv-Chisq'; set to NULL otherwise.

mu0_c

A numeric scalar giving the prior mean for the control group (or the fixed hypothetical control mean for uncontrolled design). Required when prior = 'N-Inv-Chisq'; set to NULL otherwise.

sigma0_t

A positive numeric scalar giving the prior scale parameter for the treatment group under the N-Inv-Chi-squared prior. Required when prior = 'N-Inv-Chisq'; set to NULL otherwise.

sigma0_c

A positive numeric scalar giving the prior scale parameter for the control group. Required when prior = 'N-Inv-Chisq' and design != 'uncontrolled'; set to NULL otherwise.

r

A positive numeric scalar giving the variance ratio \sigma_c^2 / \sigma_t^2 used for uncontrolled design. Required when design = 'uncontrolled'; set to NULL otherwise.

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.

alpha0e_t

A numeric scalar in (0, 1] giving the power prior weight for external treatment group data. Required when design = 'external' and ne_t is non-NULL; set to NULL otherwise.

alpha0e_c

A numeric scalar in (0, 1] giving the power prior weight for external control group data. Required when design = 'external' and ne_c is non-NULL; set to NULL otherwise.

bar_ye_t

A numeric scalar giving the sample mean of the external treatment group data. Required when ne_t is non-NULL; set to NULL otherwise.

bar_ye_c

A numeric scalar giving the sample mean of the external control group data. Required when ne_c is non-NULL; set to NULL otherwise.

se_t

A positive numeric scalar giving the sample standard deviation of the external treatment group data. Required when ne_t is non-NULL; set to NULL otherwise.

se_c

A positive numeric scalar giving the sample standard deviation of the external control group data. Required when ne_c is non-NULL; set to NULL otherwise.

gamma_grid

A numeric vector of candidate threshold values in (0, 1) to search over. Defaults to seq(0.01, 0.99, by = 0.01).

seed

A numeric scalar for reproducible random number generation. The Go-calibration simulation uses seed and the NoGo-calibration simulation uses seed + 1 to ensure independence between the two scenarios.

Details

The function uses a two-stage simulate-then-sweep strategy:

  1. Simulation: nsim datasets are generated independently for each calibration scenario. For the Go-calibration scenario, standardised residuals are shifted by mu_t_go and mu_c_go; for the NoGo-calibration scenario, by mu_t_nogo and mu_c_nogo. pbayespostpred1cont is called once per scenario to obtain g_{\mathrm{Go}} (lower.tail = FALSE at theta_TV) and g_{\mathrm{NoGo}} (lower.tail = TRUE at theta_MAV).

  2. Gamma sweep: Marginal probabilities are estimated as the proportion of simulated datasets satisfying the respective indicator: g_{\mathrm{Go}} \ge \gamma for PrGo_grid, and g_{\mathrm{NoGo}} \ge \gamma for PrNoGo_grid. Both are monotone non-increasing in \gamma.

The optimal \gamma_{\mathrm{go}} and \gamma_{\mathrm{nogo}} are each the smallest grid value crossing below the respective target probability.

Value

A list of class getgamma1cont with the following elements:

gamma_go

Optimal Go threshold: the smallest value in gamma_grid for which \Pr(\mathrm{Go}) < \code{target\_go} under the Go-calibration scenario. NA if no such value exists.

gamma_nogo

Optimal NoGo threshold: the smallest value in gamma_grid for which \Pr(\mathrm{NoGo}) < \code{target\_nogo} under the NoGo-calibration scenario. NA if no such value exists.

PrGo_opt

Marginal \Pr(g_{\mathrm{Go}} \ge \gamma_{\mathrm{go}}) at the optimal \gamma_{\mathrm{go}} under the Go-calibration scenario. NA if gamma_go is NA.

PrNoGo_opt

Marginal \Pr(g_{\mathrm{NoGo}} \ge \gamma_{\mathrm{nogo}}) at the optimal \gamma_{\mathrm{nogo}} under the NoGo-calibration scenario. NA if gamma_nogo is NA.

target_go

The value of target_go supplied by the user.

target_nogo

The value of target_nogo supplied by the user.

grid_results

A data frame with columns gamma_grid, PrGo_grid (marginal Go probability under the Go-calibration scenario), and PrNoGo_grid (marginal NoGo probability under the NoGo-calibration scenario).

Examples

# Example 1: Controlled design, vague prior, posterior probability
# gamma_go  : smallest gamma s.t. Pr(Go)   < 0.05 under Null (mu_t = mu_c = 1.0)
# gamma_nogo: smallest gamma s.t. Pr(NoGo) < 0.20 under Alt  (mu_t = 2.5, mu_c = 1.0)
getgamma1cont(
  nsim = 1000L, prob = 'posterior', design = 'controlled',
  prior = 'vague', CalcMethod = 'MM',
  theta_TV = 1.5, theta_MAV = 0.0, theta_NULL = NULL, nMC = NULL,
  mu_t_go = 1.0, mu_c_go = 1.0, sigma_t_go = 2.0, sigma_c_go = 2.0,
  mu_t_nogo = 2.5, mu_c_nogo = 1.0, sigma_t_nogo = 2.0, sigma_c_nogo = 2.0,
  target_go = 0.05, target_nogo = 0.20,
  n_t = 15L, n_c = 15L, 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,
  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,
  gamma_grid = seq(0.01, 0.99, by = 0.01), seed = 1L
)

# Example 2: Uncontrolled design, N-Inv-Chisq prior, posterior probability
getgamma1cont(
  nsim = 1000L, prob = 'posterior', design = 'uncontrolled',
  prior = 'N-Inv-Chisq', CalcMethod = 'NI',
  theta_TV = 1.0, theta_MAV = 0.0, theta_NULL = NULL, nMC = NULL,
  mu_t_go = 1.5, mu_c_go = NULL, sigma_t_go = 1.5, sigma_c_go = NULL,
  mu_t_nogo = 3.0, mu_c_nogo = NULL, sigma_t_nogo = 1.5, sigma_c_nogo = NULL,
  target_go = 0.05, target_nogo = 0.20,
  n_t = 20L, 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,
  r = 1.0, 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,
  gamma_grid = seq(0.01, 0.99, by = 0.01), seed = 2L
)

# Example 3: External design, vague prior, posterior probability
getgamma1cont(
  nsim = 1000L, prob = 'posterior', design = 'external',
  prior = 'vague', CalcMethod = 'MM',
  theta_TV = 1.0, theta_MAV = 0.0, theta_NULL = NULL, nMC = NULL,
  mu_t_go = 1.0, mu_c_go = 1.0, sigma_t_go = 1.5, sigma_c_go = 1.5,
  mu_t_nogo = 2.5, mu_c_nogo = 1.0, sigma_t_nogo = 1.5, sigma_c_nogo = 1.5,
  target_go = 0.05, target_nogo = 0.20,
  n_t = 15L, n_c = 15L, 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,
  r = NULL, ne_t = NULL, ne_c = 20L, alpha0e_t = NULL, alpha0e_c = 0.5,
  bar_ye_t = NULL, bar_ye_c = 0.0, se_t = NULL, se_c = 1.5,
  gamma_grid = seq(0.01, 0.99, by = 0.01), seed = 4L
)

# Example 4: Controlled design, vague prior, predictive probability
getgamma1cont(
  nsim = 1000L, prob = 'predictive', design = 'controlled',
  prior = 'vague', CalcMethod = 'MM',
  theta_TV = NULL, theta_MAV = NULL, theta_NULL = 1.0, nMC = NULL,
  mu_t_go = 1.0, mu_c_go = 1.0, sigma_t_go = 2.0, sigma_c_go = 2.0,
  mu_t_nogo = 2.5, mu_c_nogo = 1.0, sigma_t_nogo = 2.0, sigma_c_nogo = 2.0,
  target_go = 0.05, target_nogo = 0.20,
  n_t = 15L, n_c = 15L, m_t = 50L, m_c = 50L,
  kappa0_t = NULL, kappa0_c = NULL, nu0_t = NULL, nu0_c = NULL,
  mu0_t = NULL, mu0_c = NULL, sigma0_t = NULL, sigma0_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,
  gamma_grid = seq(0.01, 0.99, by = 0.01), seed = 3L
)

# Example 5: Uncontrolled design, vague prior, predictive probability
getgamma1cont(
  nsim = 1000L, prob = 'predictive', design = 'uncontrolled',
  prior = 'vague', CalcMethod = 'MM',
  theta_TV = NULL, theta_MAV = NULL, theta_NULL = 1.0, nMC = NULL,
  mu_t_go = 1.0, mu_c_go = NULL, sigma_t_go = 2.0, sigma_c_go = NULL,
  mu_t_nogo = 2.5, mu_c_nogo = NULL, sigma_t_nogo = 2.0, sigma_c_nogo = NULL,
  target_go = 0.05, target_nogo = 0.20,
  n_t = 15L, n_c = NULL, m_t = 50L, m_c = 50L,
  kappa0_t = NULL, kappa0_c = NULL, nu0_t = NULL, nu0_c = NULL,
  mu0_t = NULL, mu0_c = 0.0, sigma0_t = NULL, sigma0_c = NULL,
  r = 1.0, 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,
  gamma_grid = seq(0.01, 0.99, by = 0.01), seed = 5L
)

# Example 6: External design, vague prior, predictive probability
getgamma1cont(
  nsim = 1000L, prob = 'predictive', design = 'external',
  prior = 'vague', CalcMethod = 'MM',
  theta_TV = NULL, theta_MAV = NULL, theta_NULL = 1.0, nMC = NULL,
  mu_t_go = 1.0, mu_c_go = 1.0, sigma_t_go = 1.5, sigma_c_go = 1.5,
  mu_t_nogo = 2.5, mu_c_nogo = 1.0, sigma_t_nogo = 1.5, sigma_c_nogo = 1.5,
  target_go = 0.05, target_nogo = 0.20,
  n_t = 15L, n_c = 15L, m_t = 50L, m_c = 50L,
  kappa0_t = NULL, kappa0_c = NULL, nu0_t = NULL, nu0_c = NULL,
  mu0_t = NULL, mu0_c = NULL, sigma0_t = NULL, sigma0_c = NULL,
  r = NULL, ne_t = NULL, ne_c = 20L, alpha0e_t = NULL, alpha0e_c = 0.5,
  bar_ye_t = NULL, bar_ye_c = 0.0, se_t = NULL, se_c = 1.5,
  gamma_grid = seq(0.01, 0.99, by = 0.01), seed = 6L
)


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