View source: R/pbayesdecisionprob2bin.R
| pbayesdecisionprob2bin | R Documentation |
Evaluates operating characteristics (Go, NoGo, Gray probabilities) for clinical trials with two binary endpoints under the Bayesian framework. The function supports controlled, uncontrolled, and external designs, and uses both posterior probability and posterior predictive probability criteria.
pbayesdecisionprob2bin(
nsim = 10000L,
prob = "posterior",
design = "controlled",
GoRegions,
NoGoRegions,
gamma_go,
gamma_nogo,
pi_t1,
pi_t2,
rho_t,
pi_c1 = NULL,
pi_c2 = NULL,
rho_c = NULL,
n_t,
n_c = NULL,
a_t_00,
a_t_01,
a_t_10,
a_t_11,
a_c_00,
a_c_01,
a_c_10,
a_c_11,
m_t = NULL,
m_c = NULL,
theta_TV1 = NULL,
theta_MAV1 = NULL,
theta_TV2 = NULL,
theta_MAV2 = NULL,
theta_NULL1 = NULL,
theta_NULL2 = NULL,
z00 = NULL,
z01 = NULL,
z10 = NULL,
z11 = NULL,
xe_t_00 = NULL,
xe_t_01 = NULL,
xe_t_10 = NULL,
xe_t_11 = NULL,
xe_c_00 = NULL,
xe_c_01 = NULL,
xe_c_10 = NULL,
xe_c_11 = NULL,
alpha0e_t = NULL,
alpha0e_c = NULL,
nMC = 10000L,
CalcMethod = "Exact",
error_if_Miss = TRUE,
Gray_inc_Miss = FALSE
)
nsim |
A positive integer giving the number of PoC count vectors
sampled via |
prob |
A character string specifying the probability type.
Must be |
design |
A character string specifying the trial design.
Must be |
GoRegions |
An integer vector specifying which of the nine posterior
regions (R1–R9) or four predictive regions (R1–R4) constitute a
Go decision. For |
NoGoRegions |
An integer vector specifying which regions constitute a
NoGo decision. A common choice is |
gamma_go |
A numeric scalar in |
gamma_nogo |
A numeric scalar in |
pi_t1 |
A numeric vector of true treatment response probabilities
for Endpoint 1. Each element must be in |
pi_t2 |
A numeric vector of true treatment response probabilities
for Endpoint 2. Must have the same length as |
rho_t |
A numeric vector of true within-treatment-arm correlations
between Endpoint 1 and Endpoint 2. Must have the same length as
|
pi_c1 |
A numeric vector of true control response probabilities for
Endpoint 1. For |
pi_c2 |
A numeric vector of true control response probabilities for
Endpoint 2. For |
rho_c |
A numeric vector of true within-control-arm correlations.
For |
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 |
a_t_00 |
A positive numeric scalar giving the Dirichlet prior
parameter for the |
a_t_01 |
A positive numeric scalar giving the Dirichlet prior
parameter for the |
a_t_10 |
A positive numeric scalar giving the Dirichlet prior
parameter for the |
a_t_11 |
A positive numeric scalar giving the Dirichlet prior
parameter for the |
a_c_00 |
A positive numeric scalar giving the Dirichlet prior
parameter for the |
a_c_01 |
A positive numeric scalar giving the Dirichlet prior
parameter for the |
a_c_10 |
A positive numeric scalar giving the Dirichlet prior
parameter for the |
a_c_11 |
A positive numeric scalar giving the Dirichlet prior
parameter for the |
m_t |
A positive integer giving the number of patients in the
treatment group for the future trial. Required when
|
m_c |
A positive integer giving the number of patients in the
control group for the future trial. Required when
|
theta_TV1 |
A numeric scalar giving the target value (TV) threshold
for Endpoint 1. Required when |
theta_MAV1 |
A numeric scalar giving the minimum acceptable value
(MAV) threshold for Endpoint 1. Required when
|
theta_TV2 |
A numeric scalar giving the target value (TV) threshold
for Endpoint 2. Required when |
theta_MAV2 |
A numeric scalar giving the minimum acceptable value
(MAV) threshold for Endpoint 2. Required when
|
theta_NULL1 |
A numeric scalar giving the null hypothesis threshold
for Endpoint 1. Required when |
theta_NULL2 |
A numeric scalar giving the null hypothesis threshold
for Endpoint 2. Required when |
z00 |
A non-negative integer giving the hypothetical control count
for pattern |
z01 |
A non-negative integer giving the hypothetical control count
for pattern |
z10 |
A non-negative integer giving the hypothetical control count
for pattern |
z11 |
A non-negative integer giving the hypothetical control count
for pattern |
xe_t_00 |
A non-negative integer giving the external treatment group
count for pattern |
xe_t_01 |
A non-negative integer giving the external treatment group
count for pattern |
xe_t_10 |
A non-negative integer giving the external treatment group
count for pattern |
xe_t_11 |
A non-negative integer giving the external treatment group
count for pattern |
xe_c_00 |
A non-negative integer giving the external control group
count for pattern |
xe_c_01 |
A non-negative integer giving the external control group
count for pattern |
xe_c_10 |
A non-negative integer giving the external control group
count for pattern |
xe_c_11 |
A non-negative integer giving the external control group
count for pattern |
alpha0e_t |
A numeric scalar in |
alpha0e_c |
A numeric scalar in |
nMC |
A positive integer giving the number of Dirichlet draws used to
evaluate the decision probability for each count combination in
Stage 1. Used by both |
CalcMethod |
A character string specifying the computation method.
Must be |
error_if_Miss |
A logical scalar; if |
Gray_inc_Miss |
A logical scalar; if |
Computation proceeds in two stages for efficiency. In Stage 1, posterior
or predictive probabilities are precomputed for every possible multinomial
count combination (x_t, x_c). In Stage 2, operating characteristics
for each scenario are obtained by weighting the Stage 1 decisions by their
multinomial probabilities under the true parameters, avoiding repeated Monte
Carlo sampling per scenario.
Two-stage computation.
Stage 1 (precomputation): All possible multinomial count combinations
x_t are enumerated using allmultinom.
For design = 'controlled' or 'external', all combinations
x_c are also enumerated and the Go/NoGo probability matrix
PrGo[i, j] has dimensions n_t \times n_c.
For design = 'uncontrolled', the control distribution is fixed as
\mathrm{Dir}(\alpha_{2,**} + z_{**}) and does not depend on any
observed control counts; the probability matrix therefore has dimensions
n_t \times 1, eliminating the \binom{n_2+3}{3}-row control
enumeration and the associated Gamma sampling.
This stage is independent of the true scenario parameters.
Stage 2 (scenario evaluation): For each scenario
(\pi_{t1}, \pi_{t2}, \rho_t, \pi_{c1}, \pi_{c2}, \rho_c),
getjointbin converts the marginal rates and correlation
into the four-cell probability vector p_k. The multinomial
probability mass function weights the Stage 1 decisions:
\Pr(\mathrm{Go} \mid \Theta) = \sum_{i,j}
\mathbf{1}(\mathrm{Go}_{ij}) \cdot
P(x_{t,i} \mid n_1, p_t) \cdot P(x_{c,j} \mid n_2, p_c),
where \mathbf{1}(\mathrm{Go}_{ij}) is the Go indicator from Stage 1.
Stage 2 requires no additional Monte Carlo and is fast even for large
scenario grids.
Decision categories.
Go: sum of Go region probabilities \ge \gamma_1
AND sum of NoGo region probabilities < \gamma_2.
NoGo: sum of Go region probabilities < \gamma_1
AND sum of NoGo region probabilities \ge \gamma_2.
Miss: both Go and NoGo criteria satisfied simultaneously.
Gray: neither Go nor NoGo criterion satisfied.
A data frame with one row per scenario and columns:
True treatment response probability for Endpoint 1.
True treatment response probability for Endpoint 2.
True within-arm correlation in the treatment arm.
True control response probability for Endpoint 1
(omitted when design = 'uncontrolled').
True control response probability for Endpoint 2
(omitted when design = 'uncontrolled').
True within-arm correlation in the control arm
(omitted when design = 'uncontrolled').
Probability of making a Go decision.
Probability of making a Gray (inconclusive) decision.
Probability of making a NoGo decision.
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 pbayesdecisionprob2bin with
an associated print method.
# Example 1: Posterior probability, controlled design (rho > 0)
# Explores the impact of positive within-arm endpoint correlation.
pbayesdecisionprob2bin(
prob = 'posterior',
design = 'controlled',
GoRegions = 1L,
NoGoRegions = 9L,
gamma_go = 0.52,
gamma_nogo = 0.52,
pi_t1 = c(0.15, 0.25, 0.30, 0.40),
pi_t2 = c(0.20, 0.30, 0.35, 0.45),
rho_t = rep(0.6, 4),
pi_c1 = rep(0.15, 4),
pi_c2 = rep(0.20, 4),
rho_c = rep(0.6, 4),
n_t = 10, n_c = 10,
a_t_00 = 0.25, a_t_01 = 0.25, a_t_10 = 0.25, a_t_11 = 0.25,
a_c_00 = 0.25, a_c_01 = 0.25, a_c_10 = 0.25, a_c_11 = 0.25,
m_t = NULL, m_c = NULL,
theta_TV1 = 0.15, theta_MAV1 = 0.10,
theta_TV2 = 0.15, theta_MAV2 = 0.10,
theta_NULL1 = NULL, theta_NULL2 = NULL,
z00 = NULL, z01 = NULL, z10 = NULL, z11 = NULL,
xe_t_00 = NULL, xe_t_01 = NULL, xe_t_10 = NULL, xe_t_11 = NULL,
xe_c_00 = NULL, xe_c_01 = NULL, xe_c_10 = NULL, xe_c_11 = NULL,
alpha0e_t = NULL, alpha0e_c = NULL,
nMC = 100,
error_if_Miss = FALSE, Gray_inc_Miss = FALSE
)
# Example 2: Posterior probability, uncontrolled design
# Hypothetical control specified via pseudo-counts.
pbayesdecisionprob2bin(
prob = 'posterior',
design = 'uncontrolled',
GoRegions = 1L,
NoGoRegions = 9L,
gamma_go = 0.27,
gamma_nogo = 0.36,
pi_t1 = c(0.15, 0.30, 0.40),
pi_t2 = c(0.20, 0.35, 0.45),
rho_t = rep(0.2, 3),
pi_c1 = NULL,
pi_c2 = NULL,
rho_c = NULL,
n_t = 10, n_c = NULL,
a_t_00 = 0.25, a_t_01 = 0.25, a_t_10 = 0.25, a_t_11 = 0.25,
a_c_00 = 0.25, a_c_01 = 0.25, a_c_10 = 0.25, a_c_11 = 0.25,
m_t = NULL, m_c = NULL,
theta_TV1 = 0.15, theta_MAV1 = 0.10,
theta_TV2 = 0.15, theta_MAV2 = 0.10,
theta_NULL1 = NULL, theta_NULL2 = NULL,
z00 = 2L, z01 = 1L, z10 = 2L, z11 = 1L,
xe_t_00 = NULL, xe_t_01 = NULL, xe_t_10 = NULL, xe_t_11 = NULL,
xe_c_00 = NULL, xe_c_01 = NULL, xe_c_10 = NULL, xe_c_11 = NULL,
alpha0e_t = NULL, alpha0e_c = NULL,
nMC = 100,
error_if_Miss = FALSE, Gray_inc_Miss = FALSE
)
# Example 3: Posterior probability, external control design
# External control data incorporated via power prior (alpha0e_c = 0.5).
pbayesdecisionprob2bin(
prob = 'posterior',
design = 'external',
GoRegions = 1L,
NoGoRegions = 9L,
gamma_go = 0.27,
gamma_nogo = 0.36,
pi_t1 = c(0.15, 0.25, 0.30, 0.40),
pi_t2 = c(0.20, 0.30, 0.35, 0.45),
rho_t = rep(0.0, 4),
pi_c1 = rep(0.15, 4),
pi_c2 = rep(0.20, 4),
rho_c = rep(0.0, 4),
n_t = 10, n_c = 10,
a_t_00 = 0.25, a_t_01 = 0.25, a_t_10 = 0.25, a_t_11 = 0.25,
a_c_00 = 0.25, a_c_01 = 0.25, a_c_10 = 0.25, a_c_11 = 0.25,
m_t = NULL, m_c = NULL,
theta_TV1 = 0.15, theta_MAV1 = 0.10,
theta_TV2 = 0.15, theta_MAV2 = 0.10,
theta_NULL1 = NULL, theta_NULL2 = NULL,
z00 = NULL, z01 = NULL, z10 = NULL, z11 = NULL,
xe_t_00 = NULL, xe_t_01 = NULL, xe_t_10 = NULL, xe_t_11 = NULL,
xe_c_00 = 4L, xe_c_01 = 2L, xe_c_10 = 3L, xe_c_11 = 1L,
alpha0e_t = NULL, alpha0e_c = 0.5,
nMC = 100,
error_if_Miss = FALSE, Gray_inc_Miss = FALSE
)
# Example 4: Predictive probability, controlled design
# Future trial has m_t = m_c = 30 patients per arm.
pbayesdecisionprob2bin(
prob = 'predictive',
design = 'controlled',
GoRegions = 1L,
NoGoRegions = 4L,
gamma_go = 0.60,
gamma_nogo = 0.80,
pi_t1 = c(0.15, 0.25, 0.30, 0.40),
pi_t2 = c(0.20, 0.30, 0.35, 0.45),
rho_t = rep(0.3, 4),
pi_c1 = rep(0.15, 4),
pi_c2 = rep(0.20, 4),
rho_c = rep(0.3, 4),
n_t = 10, n_c = 10,
a_t_00 = 0.25, a_t_01 = 0.25, a_t_10 = 0.25, a_t_11 = 0.25,
a_c_00 = 0.25, a_c_01 = 0.25, a_c_10 = 0.25, a_c_11 = 0.25,
m_t = 30L, m_c = 30L,
theta_TV1 = NULL, theta_MAV1 = NULL,
theta_TV2 = NULL, theta_MAV2 = NULL,
theta_NULL1 = 0.10, theta_NULL2 = 0.10,
z00 = NULL, z01 = NULL, z10 = NULL, z11 = NULL,
xe_t_00 = NULL, xe_t_01 = NULL, xe_t_10 = NULL, xe_t_11 = NULL,
xe_c_00 = NULL, xe_c_01 = NULL, xe_c_10 = NULL, xe_c_11 = NULL,
alpha0e_t = NULL, alpha0e_c = NULL,
nMC = 100,
error_if_Miss = FALSE, Gray_inc_Miss = FALSE
)
# Example 5: Predictive probability, uncontrolled design
# Hypothetical control specified via pseudo-counts; future trial m_t = m_c = 30.
pbayesdecisionprob2bin(
prob = 'predictive',
design = 'uncontrolled',
GoRegions = 1L,
NoGoRegions = 4L,
gamma_go = 0.60,
gamma_nogo = 0.80,
pi_t1 = c(0.15, 0.30, 0.40),
pi_t2 = c(0.20, 0.35, 0.45),
rho_t = rep(0.7, 3),
pi_c1 = rep(0.15, 3),
pi_c2 = rep(0.20, 3),
rho_c = rep(0.7, 3),
n_t = 10, n_c = 10,
a_t_00 = 0.25, a_t_01 = 0.25, a_t_10 = 0.25, a_t_11 = 0.25,
a_c_00 = 0.25, a_c_01 = 0.25, a_c_10 = 0.25, a_c_11 = 0.25,
m_t = 30L, m_c = 30L,
theta_TV1 = NULL, theta_MAV1 = NULL,
theta_TV2 = NULL, theta_MAV2 = NULL,
theta_NULL1 = 0.10, theta_NULL2 = 0.10,
z00 = 2L, z01 = 1L, z10 = 2L, z11 = 1L,
xe_t_00 = NULL, xe_t_01 = NULL, xe_t_10 = NULL, xe_t_11 = NULL,
xe_c_00 = NULL, xe_c_01 = NULL, xe_c_10 = NULL, xe_c_11 = NULL,
alpha0e_t = NULL, alpha0e_c = NULL,
nMC = 100,
error_if_Miss = FALSE, Gray_inc_Miss = FALSE
)
# Example 6: Predictive probability, external treatment design
# External treatment data incorporated via power prior (alpha0e_t = 0.5).
pbayesdecisionprob2bin(
prob = 'predictive',
design = 'external',
GoRegions = 1L,
NoGoRegions = 4L,
gamma_go = 0.60,
gamma_nogo = 0.80,
pi_t1 = c(0.15, 0.25, 0.30, 0.40),
pi_t2 = c(0.20, 0.30, 0.35, 0.45),
rho_t = rep(0.5, 4),
pi_c1 = rep(0.15, 4),
pi_c2 = rep(0.20, 4),
rho_c = rep(0.5, 4),
n_t = 10, n_c = 10,
a_t_00 = 0.25, a_t_01 = 0.25, a_t_10 = 0.25, a_t_11 = 0.25,
a_c_00 = 0.25, a_c_01 = 0.25, a_c_10 = 0.25, a_c_11 = 0.25,
m_t = 30L, m_c = 30L,
theta_TV1 = NULL, theta_MAV1 = NULL,
theta_TV2 = NULL, theta_MAV2 = NULL,
theta_NULL1 = 0.10, theta_NULL2 = 0.10,
z00 = NULL, z01 = NULL, z10 = NULL, z11 = NULL,
xe_t_00 = 3L, xe_t_01 = 2L, xe_t_10 = 3L, xe_t_11 = 2L,
xe_c_00 = NULL, xe_c_01 = NULL, xe_c_10 = NULL, xe_c_11 = NULL,
alpha0e_t = 0.5, alpha0e_c = NULL,
nMC = 100,
error_if_Miss = FALSE, Gray_inc_Miss = FALSE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.