| getgamma1bin | R Documentation |
Computes the optimal Go threshold \gamma_{\mathrm{go}} and NoGo
threshold \gamma_{\mathrm{nogo}} for a single binary 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
(pi_t_go, pi_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 (pi_t_nogo, pi_c_nogo); typically the
Alternative scenario.
Here g_{\mathrm{Go}} = P(\theta > \theta_{\mathrm{TV}} \mid y_t, y_c)
and g_{\mathrm{NoGo}} = P(\theta \le \theta_{\mathrm{MAV}} \mid y_t, y_c)
for prob = 'posterior', consistent with the decision rule in
pbayesdecisionprob1bin.
getgamma1bin(
prob = "posterior",
design = "controlled",
theta_TV = NULL,
theta_MAV = NULL,
theta_NULL = NULL,
pi_t_go,
pi_c_go = NULL,
pi_t_nogo,
pi_c_nogo = NULL,
target_go,
target_nogo,
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,
gamma_grid = seq(0.01, 0.99, by = 0.01)
)
prob |
A character string specifying the probability type.
Must be |
design |
A character string specifying the trial design.
Must be |
theta_TV |
A numeric scalar in |
theta_MAV |
A numeric scalar in |
theta_NULL |
A numeric scalar in |
pi_t_go |
A numeric scalar in |
pi_c_go |
A numeric scalar in |
pi_t_nogo |
A numeric scalar in |
pi_c_nogo |
A numeric scalar in |
target_go |
A numeric scalar in |
target_nogo |
A numeric scalar in |
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. |
a_t |
A positive numeric scalar giving the first shape parameter of the Beta prior for the treatment group. |
a_c |
A positive numeric scalar giving the first shape parameter of the Beta prior for the control group. |
b_t |
A positive numeric scalar giving the second shape parameter of the Beta prior for the treatment group. |
b_c |
A positive numeric scalar giving the second shape parameter of the Beta prior for the control group. |
z |
A non-negative integer giving the hypothetical number of
responders in the control group. Required when
|
m_t |
A positive integer giving the future sample size for the
treatment group. Required when |
m_c |
A positive integer giving the future sample size for the
control group. Required when |
ne_t |
A positive integer giving the number of patients in the
treatment group of the external data set. Required when
|
ne_c |
A positive integer giving the number of patients in the
control group of the external data set. Required when
|
ye_t |
A non-negative integer giving the number of responders in the
treatment group of the external data set. Required when
|
ye_c |
A non-negative integer giving the number of responders in the
control group of the external data set. Required when
|
alpha0e_t |
A numeric scalar in |
alpha0e_c |
A numeric scalar in |
gamma_grid |
A numeric vector of candidate threshold values in
|
The function uses a two-stage precompute-then-sweep strategy:
Precomputation: All possible outcome pairs
(y_t, y_c) are enumerated. For each pair,
pbayespostpred1bin computes
g_{\mathrm{Go}} (lower.tail = FALSE at
theta_TV) and g_{\mathrm{NoGo}} (lower.tail
= TRUE at theta_MAV). This step is independent of
\gamma.
Gamma sweep: Marginal probabilities are computed as
weighted sums of binary indicators over the grid:
\Pr(\mathrm{Go}) uses w_go (weights under
pi_t_go, pi_c_go) and the indicator
g_{\mathrm{Go}} \ge \gamma; \Pr(\mathrm{NoGo})
uses w_nogo (weights under pi_t_nogo,
pi_c_nogo) and the indicator
g_{\mathrm{NoGo}} \ge \gamma.
Both \Pr(\mathrm{Go}) and \Pr(\mathrm{NoGo}) are
monotone non-increasing functions of \gamma. The optimal
\gamma_{\mathrm{go}} is the smallest grid value
crossing below target_go. The optimal
\gamma_{\mathrm{nogo}} is also the smallest grid value
crossing below target_nogo: a smaller \gamma_{\mathrm{nogo}}
makes NoGo harder to trigger (more permissive), so this is the least
restrictive threshold that still controls the false NoGo rate.
A list of class getgamma1bin with the following elements:
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.
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.
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.
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.
The value of target_go supplied by the user.
The value of target_nogo supplied by the user.
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).
# Example 1: Controlled design, posterior probability
# gamma_go : smallest gamma s.t. Pr(Go) < 0.05 under Null (pi_t = pi_c = 0.15)
# gamma_nogo: largest gamma s.t. Pr(NoGo) < 0.20 under Alt (pi_t = 0.35, pi_c = 0.15)
getgamma1bin(
prob = 'posterior', design = 'controlled',
theta_TV = 0.20, theta_MAV = 0.05, theta_NULL = NULL,
pi_t_go = 0.15, pi_c_go = 0.15,
pi_t_nogo = 0.35, pi_c_nogo = 0.15,
target_go = 0.05, target_nogo = 0.20,
n_t = 12L, n_c = 12L,
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
)
# Example 2: Uncontrolled design, posterior probability
getgamma1bin(
prob = 'posterior', design = 'uncontrolled',
theta_TV = 0.20, theta_MAV = 0.05, theta_NULL = NULL,
pi_t_go = 0.15, pi_c_go = NULL,
pi_t_nogo = 0.35, pi_c_nogo = NULL,
target_go = 0.05, target_nogo = 0.20,
n_t = 12L, n_c = 12L,
a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5,
z = 3L, m_t = NULL, m_c = NULL,
ne_t = NULL, ne_c = NULL, ye_t = NULL, ye_c = NULL,
alpha0e_t = NULL, alpha0e_c = NULL
)
# Example 3: External design, posterior probability
getgamma1bin(
prob = 'posterior', design = 'external',
theta_TV = 0.20, theta_MAV = 0.05, theta_NULL = NULL,
pi_t_go = 0.15, pi_c_go = 0.15,
pi_t_nogo = 0.35, pi_c_nogo = 0.15,
target_go = 0.05, target_nogo = 0.20,
n_t = 12L, n_c = 12L,
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 = 15L, ne_c = 15L, ye_t = 6L, ye_c = 4L,
alpha0e_t = 0.5, alpha0e_c = 0.5
)
# Example 4: Controlled design, predictive probability
getgamma1bin(
prob = 'predictive', design = 'controlled',
theta_TV = NULL, theta_MAV = NULL, theta_NULL = 0.10,
pi_t_go = 0.15, pi_c_go = 0.15,
pi_t_nogo = 0.35, pi_c_nogo = 0.15,
target_go = 0.05, target_nogo = 0.20,
n_t = 12L, n_c = 12L,
a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5,
z = NULL, m_t = 30L, m_c = 30L,
ne_t = NULL, ne_c = NULL, ye_t = NULL, ye_c = NULL,
alpha0e_t = NULL, alpha0e_c = NULL
)
# Example 5: Uncontrolled design, predictive probability
getgamma1bin(
prob = 'predictive', design = 'uncontrolled',
theta_TV = NULL, theta_MAV = NULL, theta_NULL = 0.10,
pi_t_go = 0.15, pi_c_go = NULL,
pi_t_nogo = 0.35, pi_c_nogo = NULL,
target_go = 0.05, target_nogo = 0.20,
n_t = 12L, n_c = 12L,
a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5,
z = 3L, m_t = 30L, m_c = 30L,
ne_t = NULL, ne_c = NULL, ye_t = NULL, ye_c = NULL,
alpha0e_t = NULL, alpha0e_c = NULL
)
# Example 6: External design, predictive probability
getgamma1bin(
prob = 'predictive', design = 'external',
theta_TV = NULL, theta_MAV = NULL, theta_NULL = 0.10,
pi_t_go = 0.15, pi_c_go = 0.15,
pi_t_nogo = 0.35, pi_c_nogo = 0.15,
target_go = 0.05, target_nogo = 0.20,
n_t = 12L, n_c = 12L,
a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5,
z = NULL, m_t = 30L, m_c = 30L,
ne_t = 15L, ne_c = 15L, ye_t = 6L, ye_c = 4L,
alpha0e_t = 0.5, alpha0e_c = 0.5
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.