View source: R/pbayesdecisionprob1cont.R
| pbayesdecisionprob1cont | R Documentation |
Evaluates Go/NoGo/Gray decision probabilities for a single continuous endpoint via Monte Carlo simulation. Supports controlled (parallel control), uncontrolled (single-arm with informative priors), and external (power prior borrowing) designs with both posterior and predictive probability approaches.
pbayesdecisionprob1cont(
nsim,
prob,
design,
prior,
CalcMethod,
theta_TV = NULL,
theta_MAV = NULL,
theta_NULL = NULL,
nMC = NULL,
gamma_go,
gamma_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,
mu_t,
mu_c = NULL,
sigma_t,
sigma_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,
error_if_Miss = TRUE,
Gray_inc_Miss = FALSE,
seed
)
nsim |
A positive integer specifying the number of Monte Carlo simulation replicates. |
prob |
A character string specifying the probability type: |
design |
A character string specifying the trial design: |
prior |
A character string specifying the prior distribution: |
CalcMethod |
A character string specifying the computation method: |
theta_TV |
A numeric value representing the target value (TV) threshold for the
Go decision. Required if |
theta_MAV |
A numeric value representing the minimum acceptable value (MAV) threshold
for the NoGo decision. Required if |
theta_NULL |
A numeric value representing the null hypothesis threshold.
Required if |
nMC |
A positive integer specifying the number of Monte Carlo draws for computing
posterior probabilities. Required if |
gamma_go |
A numeric scalar in |
gamma_nogo |
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 proof-of-concept (PoC) trial. Required for
|
m_t |
A positive integer representing the future sample size for the
treatment group. Required if |
m_c |
A positive integer representing the future sample size for the control group.
Required if |
kappa0_t |
A positive numeric value representing the prior hyperparameter kappa for
the treatment group. Required if |
kappa0_c |
A positive numeric value representing the prior hyperparameter kappa for
the control group. Required if |
nu0_t |
A positive numeric value representing the prior hyperparameter nu for
the treatment group. Required if |
nu0_c |
A positive numeric value representing the prior hyperparameter nu for
the control group. Required if |
mu0_t |
A numeric value representing the prior mean for the treatment group. Required if
|
mu0_c |
A numeric value representing the prior mean for the control group. For
|
sigma0_t |
A positive numeric value representing the prior standard deviation for
the treatment group. Required if |
sigma0_c |
A positive numeric value representing the prior standard deviation for
the control group. Required if |
mu_t |
A numeric value representing the true mean for the treatment group in the simulation. |
mu_c |
A numeric value representing the true mean for the control group in the simulation.
For uncontrolled design, this represents the historical control mean.
Set to |
sigma_t |
A positive numeric value representing the true standard deviation for the treatment group in the simulation. |
sigma_c |
A positive numeric value representing the true standard deviation
for the control group in the simulation. For uncontrolled design, this represents
the historical control standard deviation.
Set to |
r |
A positive numeric value representing the variance scaling factor that allows
the scale of hypothetical control to be different from treatment. Specifically,
|
ne_t |
A positive integer representing the number of patients in the treatment group for
the external data. Required if |
ne_c |
A positive integer representing the number of patients in the control group for
the external data. Required if |
alpha0e_t |
A numeric value in |
alpha0e_c |
A numeric value in |
bar_ye_t |
A numeric value representing the sample mean of the external data
for the treatment group. Required if |
bar_ye_c |
A numeric value representing the sample mean of the external data
for the control group. Required if |
se_t |
A positive numeric value representing the sample standard deviation
of the external data for the treatment group. Required if |
se_c |
A positive numeric value representing the sample standard deviation
of the external data for the control group. Required if |
error_if_Miss |
A logical value; if |
Gray_inc_Miss |
A logical value; if |
seed |
A numeric value representing the seed number for reproducible random number generation. |
The function performs Monte Carlo simulation to evaluate operating characteristics by:
Generating random trial data based on specified true parameters
Computing posterior or predictive probabilities for each simulated trial
Classifying each trial as Go, NoGo, or Gray based on decision thresholds
Posterior parameter calculations (mu.t1, mu.t2, sd.t1, sd.t2, nu.t1, nu.t2) are fully vectorized over the nsim simulated datasets. pbayespostpred1cont is called twice (once per threshold), with each call receiving vectors of length nsim and returning a vector of nsim probabilities - no inner loop over simulation replicates is required.
For external designs, power priors are incorporated using exact conjugate representation:
Power priors for normal data are mathematically equivalent to Normal-Inverse-Chi-squared distributions
This enables closed-form computation without MCMC sampling
Alpha parameters control the degree of borrowing (0 = no borrowing, 1 = full borrowing)
Decision rules:
Go: gGo >= gamma_go and gNoGo < gamma_nogo
NoGo: gGo < gamma_go and gNoGo >= gamma_nogo
Gray: neither Go nor NoGo criterion is met
Miss: both Go and NoGo criteria are met simultaneously
Handling Miss probability:
When error_if_Miss = TRUE (default): Function stops with error if
Miss probability > 0, prompting reconsideration of thresholds
When error_if_Miss = FALSE and Gray_inc_Miss = TRUE: Miss
probability is added to Gray probability
When error_if_Miss = FALSE and Gray_inc_Miss = FALSE: Miss
probability is reported as a separate category
The function can be used for:
Controlled design: Two-arm randomized trial
Uncontrolled design: Single-arm trial with informative priors (historical control)
External design: Incorporating historical data through power priors
A data frame containing the true means for both groups and the Go, NoGo, and
Gray probabilities. When error_if_Miss = FALSE and Gray_inc_Miss = FALSE,
Miss probability is also included as a separate column. For uncontrolled design,
only mu_t is included (not mu_c).
# Example 1: Controlled design with vague prior and NI method
# (default: error_if_Miss = TRUE, Gray_inc_Miss = FALSE)
pbayesdecisionprob1cont(
nsim = 100, prob = 'posterior', design = 'controlled', prior = 'vague', CalcMethod = 'NI',
theta_TV = 1.5, theta_MAV = -0.5, theta_NULL = NULL,
nMC = NULL, gamma_go = 0.7, gamma_nogo = 0.2,
n_t = 15, n_c = 15, 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,
mu_t = 3, mu_c = 1, sigma_t = 1.2, sigma_c = 1.1,
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,
error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 2
)
# Example 2: Uncontrolled design with informative prior
pbayesdecisionprob1cont(
nsim = 100, prob = 'posterior', design = 'uncontrolled', prior = 'N-Inv-Chisq', CalcMethod = 'NI',
theta_TV = 1.0, theta_MAV = 0.0, theta_NULL = NULL,
nMC = NULL, gamma_go = 0.8, gamma_nogo = 0.2,
n_t = 20, 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,
mu_t = 3.5, mu_c = NULL, sigma_t = 1.3, sigma_c = NULL,
r = 1, 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,
error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 3
)
# Example 3: External design with control data using MM approximation
pbayesdecisionprob1cont(
nsim = 100, prob = 'posterior', design = 'external', prior = 'vague', CalcMethod = 'MM',
theta_TV = 1.0, theta_MAV = 0.0, theta_NULL = NULL,
nMC = NULL, gamma_go = 0.8, gamma_nogo = 0.2,
n_t = 12, n_c = 12, 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,
mu_t = 2, mu_c = 0, sigma_t = 1, sigma_c = 1,
r = NULL, ne_t = NULL, ne_c = 20, alpha0e_t = NULL, alpha0e_c = 0.5,
bar_ye_t = NULL, bar_ye_c = 0, se_t = NULL, se_c = 1,
error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 4
)
# Example 4: Controlled design with predictive probability
pbayesdecisionprob1cont(
nsim = 100, prob = 'predictive', design = 'controlled', prior = 'N-Inv-Chisq', CalcMethod = 'NI',
theta_TV = NULL, theta_MAV = NULL, theta_NULL = 2.0,
nMC = NULL, gamma_go = 0.75, gamma_nogo = 0.35,
n_t = 15, n_c = 15, m_t = 50, m_c = 50,
kappa0_t = 3, kappa0_c = 3, nu0_t = 4, nu0_c = 4,
mu0_t = 3.5, mu0_c = 1.5, sigma0_t = 1.5, sigma0_c = 1.5,
mu_t = 3.2, mu_c = 1.3, sigma_t = 1.4, sigma_c = 1.2,
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,
error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 5
)
# Example 5: Uncontrolled design with predictive probability
pbayesdecisionprob1cont(
nsim = 100, prob = 'predictive', design = 'uncontrolled', prior = 'vague', CalcMethod = 'NI',
theta_TV = NULL, theta_MAV = NULL, theta_NULL = 1.0,
nMC = NULL, gamma_go = 0.75, gamma_nogo = 0.35,
n_t = 20, n_c = NULL, m_t = 40, m_c = 40,
kappa0_t = NULL, kappa0_c = NULL, nu0_t = NULL, nu0_c = NULL,
mu0_t = NULL, mu0_c = 1.5, sigma0_t = NULL, sigma0_c = NULL,
mu_t = 3, mu_c = NULL, sigma_t = 1.3, sigma_c = NULL,
r = 1, 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,
error_if_Miss = TRUE, Gray_inc_Miss = FALSE, seed = 9
)
# Example 6: External design with predictive probability using MC method
pbayesdecisionprob1cont(
nsim = 100, prob = 'predictive', design = 'external', prior = 'vague', CalcMethod = 'MC',
theta_TV = NULL, theta_MAV = NULL, theta_NULL = 1.5,
nMC = 5000, gamma_go = 0.7, gamma_nogo = 0.4,
n_t = 12, n_c = 12, m_t = 30, m_c = 30,
kappa0_t = NULL, kappa0_c = NULL, nu0_t = NULL, nu0_c = NULL,
mu0_t = NULL, mu0_c = NULL, sigma0_t = NULL, sigma0_c = NULL,
mu_t = 2.5, mu_c = 1.0, sigma_t = 1.3, sigma_c = 1.1,
r = NULL, ne_t = 15, ne_c = 18, alpha0e_t = 0.6, alpha0e_c = 0.7,
bar_ye_t = 2.3, bar_ye_c = 0.9, se_t = 1.2, se_c = 1.0,
error_if_Miss = FALSE, Gray_inc_Miss = FALSE, seed = 6
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.