View source: R/pbayesdecisionprob2cont.R
| pbayesdecisionprob2cont | R Documentation |
Computes the operating characteristics (Go, NoGo, Gray, and optionally Miss probabilities) for a two-continuous-endpoint Bayesian Go/NoGo decision framework by Monte Carlo simulation over treatment scenarios.
pbayesdecisionprob2cont(
nsim,
prob,
design,
prior,
GoRegions,
NoGoRegions,
gamma_go,
gamma_nogo,
theta_TV1 = NULL,
theta_MAV1 = NULL,
theta_TV2 = NULL,
theta_MAV2 = NULL,
theta_NULL1 = NULL,
theta_NULL2 = NULL,
n_t,
n_c = NULL,
m_t = NULL,
m_c = NULL,
mu_t,
Sigma_t,
mu_c = NULL,
Sigma_c = NULL,
kappa0_t = NULL,
nu0_t = NULL,
mu0_t = NULL,
Lambda0_t = NULL,
kappa0_c = NULL,
nu0_c = NULL,
mu0_c = NULL,
Lambda0_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,
nMC = NULL,
CalcMethod = "MC",
error_if_Miss = TRUE,
Gray_inc_Miss = FALSE,
seed
)
nsim |
A positive integer. Number of simulated datasets per scenario. |
prob |
A character string specifying the probability type.
Must be |
design |
A character string specifying the trial design.
Must be |
prior |
A character string specifying the prior distribution.
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 |
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 |
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 |
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
|
mu_t |
Numeric matrix with 2 columns. Each row gives the true treatment mean vector for one scenario. A length-2 vector is coerced to a 1-row matrix. |
Sigma_t |
A 2x2 positive-definite matrix. True treatment covariance. |
mu_c |
Numeric matrix with 2 columns or a length-2 vector. True control (or hypothetical control) mean vector(s). |
Sigma_c |
A 2x2 positive-definite matrix. True control covariance. |
kappa0_t |
A positive numeric scalar giving the NIW prior
concentration parameter for the treatment group. Required when
|
nu0_t |
A numeric scalar giving the NIW prior degrees of freedom for
the treatment group. Must be greater than 3. Required when
|
mu0_t |
A numeric vector of length 2 giving the NIW prior mean for
the treatment group. Required when
|
Lambda0_t |
A 2x2 positive-definite numeric matrix giving the NIW
prior scale matrix for the treatment group. Required when
|
kappa0_c |
A positive numeric scalar giving the NIW prior
concentration parameter for the control group. Required when
|
nu0_c |
A numeric scalar giving the NIW prior degrees of freedom for
the control group. Must be greater than 3. Required when
|
mu0_c |
A numeric vector of length 2 giving the NIW prior mean for
the control group, or the hypothetical control location when
|
Lambda0_c |
A 2x2 positive-definite numeric matrix giving the NIW
prior scale matrix for the control group. Required when
|
r |
A positive numeric scalar giving the variance scaling factor for
the hypothetical control distribution. Required when
|
ne_t |
A positive integer giving the external treatment group sample
size. Required when |
ne_c |
A positive integer giving the external control group sample
size. Required when |
alpha0e_t |
A numeric scalar in |
alpha0e_c |
A numeric scalar in |
bar_ye_t |
A numeric vector of length 2 giving the external treatment
group sample mean. Required when external treatment data are used;
otherwise set to |
bar_ye_c |
A numeric vector of length 2 giving the external control
group sample mean. Required when external control data are used;
otherwise set to |
se_t |
A 2x2 numeric matrix giving the external treatment group
sum-of-squares matrix. Required when external treatment data are
used; otherwise set to |
se_c |
A 2x2 numeric matrix giving the external control group
sum-of-squares matrix. Required when external control data are
used; otherwise set to |
nMC |
A positive integer giving the number of Monte Carlo draws used
to estimate region probabilities. Default is |
CalcMethod |
A character string specifying the computation method.
Must be |
error_if_Miss |
Logical. If |
Gray_inc_Miss |
Logical. If |
seed |
A single numeric value. Seed for reproducible random number generation. |
The function follows the same structure as
pbayesdecisionprob1cont:
For each scenario s, nsim datasets are simulated by
generating treatment (and control) observations from
N_2(\mu_k^{(s)}, \Sigma_k). To minimise overhead, raw
standardised residuals are generated once (scenario-
invariant) and shifted by the scenario mean.
All nsim simulated sufficient statistics
(\bar{y}_{1,i}, S_{1,i}) (and (\bar{y}_{2,i}, S_{2,i})
for controlled/external designs) are passed to
pbayespostpred2cont in a single vectorised
call, returning an nsim \times n_{\rm regions} matrix of
region probabilities.
Go/NoGo/Miss probabilities are obtained as the column means of indicator matrices derived from the region probability matrix.
A data frame of class c("pbayesdecisionprob2cont", "data.frame")
with columns for the scenario parameters and Go, NoGo, Gray
(and optionally Miss) probabilities. All input parameters are
attached as attributes.
# Example 1: Controlled design, posterior probability, vague prior
Sigma <- matrix(c(4.0, 0.8, 0.8, 1.0), 2, 2)
pbayesdecisionprob2cont(
nsim = 100L, prob = 'posterior', design = 'controlled',
prior = 'vague',
GoRegions = 1L, NoGoRegions = 9L,
gamma_go = 0.8, gamma_nogo = 0.8,
theta_TV1 = 1.5, theta_MAV1 = 0.5,
theta_TV2 = 1.0, theta_MAV2 = 0.3,
theta_NULL1 = NULL, theta_NULL2 = NULL,
n_t = 20L, n_c = 20L, m_t = NULL, m_c = NULL,
mu_t = rbind(c(1.0, 0.5), c(2.5, 1.5), c(4.0, 2.5)),
Sigma_t = Sigma,
mu_c = rbind(c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0)),
Sigma_c = Sigma,
kappa0_t = NULL, nu0_t = NULL, mu0_t = NULL, Lambda0_t = NULL,
kappa0_c = NULL, nu0_c = NULL, mu0_c = NULL, Lambda0_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,
nMC = 500L, CalcMethod = 'MC',
error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 1L
)
# Example 2: Uncontrolled design, posterior probability, NIW prior
Sigma <- matrix(c(4.0, 0.8, 0.8, 1.0), 2, 2)
L0 <- matrix(c(8.0, 0.0, 0.0, 2.0), 2, 2)
pbayesdecisionprob2cont(
nsim = 100L, prob = 'posterior', design = 'uncontrolled',
prior = 'N-Inv-Wishart',
GoRegions = 1L, NoGoRegions = 9L,
gamma_go = 0.8, gamma_nogo = 0.8,
theta_TV1 = 1.5, theta_MAV1 = 0.5,
theta_TV2 = 1.0, theta_MAV2 = 0.3,
theta_NULL1 = NULL, theta_NULL2 = NULL,
n_t = 20L, n_c = NULL, m_t = NULL, m_c = NULL,
mu_t = rbind(c(1.0, 0.5), c(2.5, 1.5), c(4.0, 2.5)),
Sigma_t = Sigma,
mu_c = rbind(c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0)),
Sigma_c = Sigma,
kappa0_t = 2.0, nu0_t = 5.0, mu0_t = c(2.0, 1.0), Lambda0_t = L0,
kappa0_c = NULL, nu0_c = NULL, mu0_c = c(0.0, 0.0), Lambda0_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,
nMC = 500L, CalcMethod = 'MC',
error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 3L
)
# Example 3: External design (control only), posterior probability, NIW prior
Sigma <- matrix(c(4.0, 0.8, 0.8, 1.0), 2, 2)
L0 <- matrix(c(8.0, 0.0, 0.0, 2.0), 2, 2)
se_mat <- matrix(c(7.0, 1.2, 1.2, 1.8), 2, 2)
pbayesdecisionprob2cont(
nsim = 100L, prob = 'posterior', design = 'external',
prior = 'N-Inv-Wishart',
GoRegions = 1L, NoGoRegions = 9L,
gamma_go = 0.8, gamma_nogo = 0.8,
theta_TV1 = 1.5, theta_MAV1 = 0.5,
theta_TV2 = 1.0, theta_MAV2 = 0.3,
theta_NULL1 = NULL, theta_NULL2 = NULL,
n_t = 20L, n_c = 20L, m_t = NULL, m_c = NULL,
mu_t = rbind(c(1.0, 0.5), c(2.5, 1.5), c(4.0, 2.5)),
Sigma_t = Sigma,
mu_c = rbind(c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0)),
Sigma_c = Sigma,
kappa0_t = 2.0, nu0_t = 5.0, mu0_t = c(2.0, 1.0), Lambda0_t = L0,
kappa0_c = 2.0, nu0_c = 5.0, mu0_c = c(0.0, 0.0), Lambda0_c = L0,
r = NULL,
ne_t = NULL, ne_c = 15L, alpha0e_t = NULL, alpha0e_c = 0.5,
bar_ye_t = NULL, bar_ye_c = c(0.2, 0.1), se_t = NULL, se_c = se_mat,
nMC = 500L, CalcMethod = 'MC',
error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 5L
)
# Example 4: Controlled design, predictive probability, NIW prior
Sigma <- matrix(c(4.0, 0.8, 0.8, 1.0), 2, 2)
L0 <- matrix(c(8.0, 0.0, 0.0, 2.0), 2, 2)
pbayesdecisionprob2cont(
nsim = 100L, prob = 'predictive', design = 'controlled',
prior = 'N-Inv-Wishart',
GoRegions = 1L, NoGoRegions = 4L,
gamma_go = 0.8, gamma_nogo = 0.8,
theta_TV1 = NULL, theta_MAV1 = NULL,
theta_TV2 = NULL, theta_MAV2 = NULL,
theta_NULL1 = 0.5, theta_NULL2 = 0.3,
n_t = 20L, n_c = 20L, m_t = 60L, m_c = 60L,
mu_t = rbind(c(1.0, 0.5), c(2.5, 1.5), c(4.0, 2.5)),
Sigma_t = Sigma,
mu_c = rbind(c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0)),
Sigma_c = Sigma,
kappa0_t = 2.0, nu0_t = 5.0, mu0_t = c(2.0, 1.0), Lambda0_t = L0,
kappa0_c = 2.0, nu0_c = 5.0, mu0_c = c(0.0, 0.0), Lambda0_c = L0,
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,
nMC = 500L, CalcMethod = 'MC',
error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 4L
)
# Example 5: Uncontrolled design, predictive probability, vague prior
Sigma <- matrix(c(4.0, 0.8, 0.8, 1.0), 2, 2)
pbayesdecisionprob2cont(
nsim = 100L, prob = 'predictive', design = 'uncontrolled',
prior = 'vague',
GoRegions = 1L, NoGoRegions = 4L,
gamma_go = 0.8, gamma_nogo = 0.8,
theta_TV1 = NULL, theta_MAV1 = NULL,
theta_TV2 = NULL, theta_MAV2 = NULL,
theta_NULL1 = 0.5, theta_NULL2 = 0.3,
n_t = 20L, n_c = NULL, m_t = 60L, m_c = 60L,
mu_t = rbind(c(1.0, 0.5), c(2.5, 1.5), c(4.0, 2.5)),
Sigma_t = Sigma,
mu_c = NULL,
Sigma_c = NULL,
kappa0_t = NULL, nu0_t = NULL, mu0_t = NULL, Lambda0_t = NULL,
kappa0_c = NULL, nu0_c = NULL, mu0_c = c(0.0, 0.0), Lambda0_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,
nMC = 500L, CalcMethod = 'MC',
error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 8L
)
# Example 6: External design (control only), predictive probability, NIW prior
Sigma <- matrix(c(4.0, 0.8, 0.8, 1.0), 2, 2)
L0 <- matrix(c(8.0, 0.0, 0.0, 2.0), 2, 2)
se_mat <- matrix(c(7.0, 1.2, 1.2, 1.8), 2, 2)
pbayesdecisionprob2cont(
nsim = 100L, prob = 'predictive', design = 'external',
prior = 'N-Inv-Wishart',
GoRegions = 1L, NoGoRegions = 4L,
gamma_go = 0.8, gamma_nogo = 0.8,
theta_TV1 = NULL, theta_MAV1 = NULL,
theta_TV2 = NULL, theta_MAV2 = NULL,
theta_NULL1 = 0.5, theta_NULL2 = 0.3,
n_t = 20L, n_c = 20L, m_t = 60L, m_c = 60L,
mu_t = rbind(c(1.0, 0.5), c(2.5, 1.5), c(4.0, 2.5)),
Sigma_t = Sigma,
mu_c = rbind(c(0.0, 0.0), c(0.0, 0.0), c(0.0, 0.0)),
Sigma_c = Sigma,
kappa0_t = 2.0, nu0_t = 5.0, mu0_t = c(2.0, 1.0), Lambda0_t = L0,
kappa0_c = 2.0, nu0_c = 5.0, mu0_c = c(0.0, 0.0), Lambda0_c = L0,
r = NULL,
ne_t = NULL, ne_c = 15L, alpha0e_t = NULL, alpha0e_c = 0.5,
bar_ye_t = NULL, bar_ye_c = c(0.2, 0.1), se_t = NULL, se_c = se_mat,
nMC = 500L, CalcMethod = 'MC',
error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 9L
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.