View source: R/pbayespostpred1bin.R
| pbayespostpred1bin | R Documentation |
Computes the Bayesian posterior probability or posterior predictive
probability for binary-outcome clinical trials under a beta-binomial
conjugate model. The function supports controlled, uncontrolled, and
external designs, with optional incorporation of external data through
power priors. Vector inputs for y_t and y_c are supported
for efficient batch processing (e.g., across all possible trial outcomes
in pbayesdecisionprob1bin).
pbayespostpred1bin(
prob = "posterior",
design = "controlled",
theta0,
n_t,
n_c,
y_t,
y_c = NULL,
a_t,
a_c,
b_t,
b_c,
m_t = NULL,
m_c = NULL,
z = NULL,
ne_t = NULL,
ne_c = NULL,
ye_t = NULL,
ye_c = NULL,
alpha0e_t = NULL,
alpha0e_c = NULL,
lower.tail = TRUE
)
prob |
A character string specifying the probability type.
Must be |
design |
A character string specifying the trial design.
Must be |
theta0 |
A numeric scalar in |
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 |
y_t |
A non-negative integer or integer vector giving the observed
number of responders in the treatment group (must satisfy
|
y_c |
A non-negative integer or integer vector giving the number of
responders in the control group (must satisfy
|
a_t |
A positive numeric scalar giving the first shape parameter (alpha) of the prior Beta distribution for the treatment group. |
a_c |
A positive numeric scalar giving the first shape parameter (alpha) of the prior Beta distribution for the control group. |
b_t |
A positive numeric scalar giving the second shape parameter (beta) of the prior Beta distribution for the treatment group. |
b_c |
A positive numeric scalar giving the second shape parameter (beta) of the prior Beta distribution for the control group. |
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
|
z |
A non-negative integer giving the hypothetical number of responders
in 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 |
lower.tail |
A logical scalar; if |
Posterior shape parameters are computed from the beta-binomial conjugate model:
Prior: \pi_j \sim \mathrm{Beta}(a_j, b_j).
Posterior:
\pi_j \mid y_j \sim \mathrm{Beta}(a_j + y_j, b_j + n_j - y_j).
For design = 'external', external data are incorporated through
the power prior, which inflates the prior by the weighted external
sufficient statistics:
(\alpha_j^*, \beta_j^*) = (a_j + ae_j \cdot ye_j, b_j + ae_j \cdot
(ne_j - ye_j)).
For design = 'uncontrolled', the hypothetical control value
z is used in place of y_c, and n_c acts as the
hypothetical control sample size.
The final probability is obtained by calling pbetadiff for
prob = 'posterior' or pbetabinomdiff for
prob = 'predictive', applied element-wise via mapply.
A numeric scalar or vector in [0, 1]. When y_t and
y_c are vectors of length n, a vector of length
n is returned.
# Example 1: Controlled design - posterior probability
pbayespostpred1bin(
prob = 'posterior', design = 'controlled', theta0 = 0.15,
n_t = 12, n_c = 15, y_t = 7, y_c = 5,
a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5,
m_t = NULL, m_c = NULL, z = NULL,
ne_t = NULL, ne_c = NULL, ye_t = NULL, ye_c = NULL,
alpha0e_t = NULL, alpha0e_c = NULL, lower.tail = FALSE
)
# Example 2: Uncontrolled design - posterior probability
pbayespostpred1bin(
prob = 'posterior', design = 'uncontrolled', theta0 = 0.20,
n_t = 20, n_c = 20, y_t = 12, y_c = NULL,
a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5,
m_t = NULL, m_c = NULL, z = 3,
ne_t = NULL, ne_c = NULL, ye_t = NULL, ye_c = NULL,
alpha0e_t = NULL, alpha0e_c = NULL, lower.tail = FALSE
)
# Example 3: External design - posterior probability
pbayespostpred1bin(
prob = 'posterior', design = 'external', theta0 = 0.15,
n_t = 12, n_c = 15, y_t = 7, y_c = 9,
a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5,
m_t = NULL, m_c = NULL, z = NULL,
ne_t = 12, ne_c = 12, ye_t = 6, ye_c = 6, alpha0e_t = 0.5, alpha0e_c = 0.5,
lower.tail = FALSE
)
# Example 4: Controlled design - posterior predictive probability
pbayespostpred1bin(
prob = 'predictive', design = 'controlled', theta0 = 0.10,
n_t = 12, n_c = 15, y_t = 7, y_c = 5,
a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5,
m_t = 30, m_c = 30, z = NULL,
ne_t = NULL, ne_c = NULL, ye_t = NULL, ye_c = NULL,
alpha0e_t = NULL, alpha0e_c = NULL, lower.tail = FALSE
)
# Example 5: Uncontrolled design - posterior predictive probability
pbayespostpred1bin(
prob = 'predictive', design = 'uncontrolled', theta0 = 0.20,
n_t = 20, n_c = 20, y_t = 12, y_c = NULL,
a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5,
m_t = 30, m_c = 30, z = 3,
ne_t = NULL, ne_c = NULL, ye_t = NULL, ye_c = NULL,
alpha0e_t = NULL, alpha0e_c = NULL, lower.tail = FALSE
)
# Example 6: External design - posterior predictive probability
pbayespostpred1bin(
prob = 'predictive', design = 'external', theta0 = 0.15,
n_t = 12, n_c = 15, y_t = 7, y_c = 9,
a_t = 0.5, a_c = 0.5, b_t = 0.5, b_c = 0.5,
m_t = 30, m_c = 30, z = NULL,
ne_t = 12, ne_c = 12, ye_t = 6, ye_c = 6, alpha0e_t = 0.5, alpha0e_c = 0.5,
lower.tail = FALSE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.