View source: R/pbayespostpred1cont.R
| pbayespostpred1cont | R Documentation |
Computes the Bayesian posterior probability or posterior predictive
probability for continuous-outcome clinical trials under a
Normal-Inverse-Chi-squared (or vague Jeffreys) conjugate model. The
function supports controlled, uncontrolled, and external designs, with
optional incorporation of external data through power priors. Vector
inputs for bar_y_t, s_t, bar_y_c, and s_c
are supported for efficient batch processing (e.g., across simulation
replicates in pbayesdecisionprob1cont).
pbayespostpred1cont(
prob = "posterior",
design = "controlled",
prior = "vague",
CalcMethod = "NI",
theta0,
nMC = NULL,
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,
bar_y_t,
bar_y_c = NULL,
s_t,
s_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,
lower.tail = TRUE
)
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 type.
Must be |
CalcMethod |
A character string specifying the calculation method.
Must be |
theta0 |
A numeric scalar giving the threshold for the treatment effect (difference in means). |
nMC |
A positive integer giving the number of Monte Carlo draws.
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. Required 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
|
kappa0_t |
A positive numeric scalar giving the prior precision
parameter for the treatment group. Required when
|
kappa0_c |
A positive numeric scalar giving the prior precision
parameter for the control group. Required when
|
nu0_t |
A positive numeric scalar giving the prior degrees of freedom
for the treatment group. Required when |
nu0_c |
A positive numeric scalar giving the prior degrees of freedom
for the control group. Required when |
mu0_t |
A numeric scalar giving the prior mean for the treatment
group. Required when |
mu0_c |
A numeric scalar giving the prior mean for the control group
( |
sigma0_t |
A positive numeric scalar giving the prior scale for the
treatment group. Required when |
sigma0_c |
A positive numeric scalar giving the prior scale for the
control group. Required when |
bar_y_t |
A numeric scalar or vector giving the sample mean for the
treatment group. When a vector of length |
bar_y_c |
A numeric scalar or vector giving the sample mean for the
control group. Required for |
s_t |
A positive numeric scalar or vector giving the sample standard deviation for the treatment group. |
s_c |
A positive numeric scalar or vector giving the sample standard
deviation for the control group. Required for
|
r |
A positive numeric scalar giving the variance scaling factor for
the hypothetical control. Required for |
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
|
alpha0e_t |
A numeric scalar in |
alpha0e_c |
A numeric scalar in |
bar_ye_t |
A numeric scalar giving the external treatment group
sample mean. Required when |
bar_ye_c |
A numeric scalar giving the external control group sample
mean. Required when |
se_t |
A positive numeric scalar giving the external treatment group
sample SD. Required when |
se_c |
A positive numeric scalar giving the external control group
sample SD. Required when |
lower.tail |
A logical scalar; if |
Under the Normal-Inverse-Chi-squared (N-Inv-ChiSq) conjugate model, the
marginal posterior/predictive distribution of the group mean follows a
non-standardised t-distribution, parameterised by a location
\mu_j, a scale \sigma_j, and degrees of freedom \nu_j
that depend on the design and probability type. The final probability is
computed by one of three methods:
NI: exact numerical integration via ptdiff_NI.
MC: Monte Carlo simulation via ptdiff_MC.
MM: Moment-Matching approximation via
ptdiff_MM.
Performance note: CalcMethod = 'NI' calls
integrate() once per element of the input vector, which is
prohibitively slow for large vectors (e.g., nsim x n_scenarios).
CalcMethod = 'MC' creates an nMC x n matrix internally,
consuming O(nMC \cdot n) memory. For large-scale simulation use
CalcMethod = 'MM', which is fully vectorised and exact in the
normal limit.
A numeric scalar or vector in [0, 1]. When the input data
parameters (bar_y_t, etc.) are vectors of length n,
a vector of length n is returned.
# Example 1: Controlled design - posterior probability with N-Inv-Chisq
pbayespostpred1cont(
prob = 'posterior', design = 'controlled', prior = 'N-Inv-Chisq',
CalcMethod = 'NI', theta0 = 2, n_t = 12, n_c = 12,
kappa0_t = 5, kappa0_c = 5, nu0_t = 5, nu0_c = 5,
mu0_t = 5, mu0_c = 5, sigma0_t = sqrt(5), sigma0_c = sqrt(5),
bar_y_t = 2, bar_y_c = 0, s_t = 1, s_c = 1,
m_t = NULL, m_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,
lower.tail = FALSE
)
# Example 2: Uncontrolled design - posterior probability with vague prior
pbayespostpred1cont(
prob = 'posterior', design = 'uncontrolled', prior = 'vague',
CalcMethod = 'MM', theta0 = 1.5, n_t = 15, n_c = NULL,
bar_y_t = 3.5, bar_y_c = NULL, s_t = 1.2, s_c = NULL,
mu0_c = 1.5, r = 1.2,
kappa0_t = NULL, kappa0_c = NULL, nu0_t = NULL, nu0_c = NULL,
mu0_t = NULL, sigma0_t = NULL, sigma0_c = NULL,
m_t = NULL, m_c = 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,
lower.tail = FALSE
)
# Example 3: External design - posterior probability
pbayespostpred1cont(
prob = 'posterior', design = 'external', prior = 'N-Inv-Chisq',
CalcMethod = 'MM', theta0 = 2, n_t = 12, n_c = 12,
kappa0_t = 5, kappa0_c = 5, nu0_t = 5, nu0_c = 5,
mu0_t = 5, mu0_c = 5, sigma0_t = sqrt(5), sigma0_c = sqrt(5),
bar_y_t = 2.5, bar_y_c = 1, s_t = 1.1, s_c = 0.9,
m_t = NULL, m_c = NULL, r = NULL,
ne_t = 10, ne_c = 10, alpha0e_t = 0.5, alpha0e_c = 0.5,
bar_ye_t = 2, bar_ye_c = 0.5, se_t = 1, se_c = 0.8,
lower.tail = FALSE
)
# Example 4: Controlled design - posterior predictive probability
pbayespostpred1cont(
prob = 'predictive', design = 'controlled', prior = 'N-Inv-Chisq',
CalcMethod = 'MM', theta0 = 1, n_t = 12, n_c = 12,
kappa0_t = 5, kappa0_c = 5, nu0_t = 5, nu0_c = 5,
mu0_t = 5, mu0_c = 5, sigma0_t = sqrt(5), sigma0_c = sqrt(5),
bar_y_t = 2, bar_y_c = 0, s_t = 1, s_c = 1,
m_t = 20, m_c = 20, 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,
lower.tail = FALSE
)
# Example 5: Uncontrolled design - posterior predictive probability
pbayespostpred1cont(
prob = 'predictive', design = 'uncontrolled', prior = 'vague',
CalcMethod = 'MM', theta0 = 1.5, n_t = 15, n_c = NULL,
bar_y_t = 3.5, bar_y_c = NULL, s_t = 1.2, s_c = NULL,
mu0_c = 1.5, r = 1.2,
kappa0_t = NULL, kappa0_c = NULL, nu0_t = NULL, nu0_c = NULL,
mu0_t = NULL, sigma0_t = NULL, sigma0_c = NULL,
m_t = 20, m_c = 20,
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,
lower.tail = FALSE
)
# Example 6: External design - posterior predictive probability
pbayespostpred1cont(
prob = 'predictive', design = 'external', prior = 'N-Inv-Chisq',
CalcMethod = 'MM', theta0 = 1, n_t = 12, n_c = 12,
kappa0_t = 5, kappa0_c = 5, nu0_t = 5, nu0_c = 5,
mu0_t = 5, mu0_c = 5, sigma0_t = sqrt(5), sigma0_c = sqrt(5),
bar_y_t = 2.5, bar_y_c = 1, s_t = 1.1, s_c = 0.9,
m_t = 20, m_c = 20, r = NULL,
ne_t = 10, ne_c = 10, alpha0e_t = 0.5, alpha0e_c = 0.5,
bar_ye_t = 2, bar_ye_c = 0.5, se_t = 1, se_c = 0.8,
lower.tail = FALSE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.