Overview
The BayesianQDM package provides comprehensive methods for Bayesian quantitative decision-making in clinical trials. This vignette demonstrates the basic functionality for both binary and continuous endpoints.
Decision Framework
The package implements a three-zone decision framework:
- Go: Sufficient evidence to proceed (high posterior probability)
- NoGo: Insufficient evidence (low posterior probability)
- Gray: Inconclusive evidence (intermediate probability)
Binary Endpoints
Basic Example
# Calculate decision probabilities for binary endpoint
result_binary <- pGNGsinglebinary(
prob = 'posterior',
design = 'controlled',
theta.TV = 0.3, theta.MAV = 0.1, theta.NULL = NULL,
gamma1 = 0.8, gamma2 = 0.2,
pi1 = c(0.3, 0.5, 0.7),
pi2 = rep(0.2, 3),
n1 = 15, n2 = 15,
a1 = 0.5, a2 = 0.5, b1 = 0.5, b2 = 0.5,
z = NULL, m1 = NULL, m2 = NULL,
ne1 = NULL, ne2 = NULL, ye1 = NULL, ye2 = NULL, ae1 = NULL, ae2 = NULL
)
print(result_binary)
#> pi1 pi2 Go Gray NoGo
#> 1 0.3 0.2 0.01578194 0.1810868 0.8031312
#> 2 0.5 0.2 0.21141006 0.4500322 0.3385577
#> 3 0.7 0.2 0.67440950 0.2761393 0.0494512Posterior Probability
# Calculate posterior probability
posterior_prob <- pPPsinglebinary(
prob = 'posterior',
design = 'controlled',
theta0 = 0.15,
n1 = 12, n2 = 15, y1 = 7, y2 = 5,
a1 = 0.5, a2 = 0.5, b1 = 0.5, b2 = 0.5,
m1 = NULL, m2 = NULL,
ne1 = NULL, ne2 = NULL, ye1 = NULL, ye2 = NULL, ae1 = NULL, ae2 = NULL
)
cat("Posterior probability:", round(posterior_prob, 4))
#> Posterior probability: 0.3139Continuous Endpoints
Basic Example
# Calculate decision probabilities for continuous endpoint
result_continuous <- pGNGsinglecontinuous(
nsim = 50, # Small nsim for vignette speed
prob = 'posterior',
design = 'controlled',
prior = 'vague',
CalcMethod = 'WS', # Fast method for vignette
theta.TV = 1.5, theta.MAV = 0.5, theta.NULL = NULL,
nMC = NULL, gamma1 = 0.8, gamma2 = 0.3,
n1 = 12, n2 = 12, m1 = NULL, m2 = NULL,
kappa01 = NULL, kappa02 = NULL, nu01 = NULL, nu02 = NULL,
mu01 = NULL, mu02 = NULL, sigma01 = NULL, sigma02 = NULL,
mu1 = 4.5, mu2 = 2.0, sigma1 = 1.5, sigma2 = 1.3,
r = NULL, ne1 = NULL, ne2 = NULL, alpha01 = NULL, alpha02 = NULL,
bar.ye1 = NULL, bar.ye2 = NULL, se1 = NULL, se2 = NULL,
seed = 123
)
print(result_continuous)
#> mu1 mu2 Go Gray NoGo
#> 1 4.5 2 0.82 0.18 0Comparing Calculation Methods
# Compare NI and WS methods
prob_ni <- pPPsinglecontinuous(
prob = 'posterior', design = 'controlled', prior = 'vague', CalcMethod = 'NI',
theta0 = 1, n1 = 12, n2 = 12, bar.y1 = 3, bar.y2 = 1, s1 = 1.5, s2 = 1.2
)
prob_ws <- pPPsinglecontinuous(
prob = 'posterior', design = 'controlled', prior = 'vague', CalcMethod = 'WS',
theta0 = 1, n1 = 12, n2 = 12, bar.y1 = 3, bar.y2 = 1, s1 = 1.5, s2 = 1.2
)
cat("NI method:", round(prob_ni, 4), "\n")
#> NI method: 0.0503
cat("WS method:", round(prob_ws, 4), "\n")
#> WS method: 0.0429
cat("Difference:", round(abs(prob_ni - prob_ws), 4), "\n")
#> Difference: 0.0074Study Designs
The package supports three study designs:
- Controlled Design: Standard two-arm randomized trial
- Uncontrolled Design: Single-arm with historical control
- External Control Design: Incorporating historical data through power priors
External Control Example
# Binary endpoint with external control data
external_binary <- pPPsinglebinary(
prob = 'posterior',
design = 'external',
theta0 = 0.15,
n1 = 20, n2 = 20, y1 = 12, y2 = 8,
a1 = 0.5, a2 = 0.5, b1 = 0.5, b2 = 0.5,
m1 = NULL, m2 = NULL,
ne1 = 15, ne2 = 25, ye1 = 9, ye2 = 10, ae1 = 0.5, ae2 = 0.5
)
cat("Posterior probability with external data:", round(external_binary, 4), "\n")
#> Posterior probability with external data: 0.3579
# Continuous endpoint with external control data
external_continuous <- pPPsinglecontinuous(
prob = 'posterior',
design = 'external',
prior = 'vague',
CalcMethod = 'WS',
theta0 = 1.5,
n1 = 20, n2 = 20,
bar.y1 = 5.5, bar.y2 = 3.2,
s1 = 2.1, s2 = 1.9,
ne1 = NULL, ne2 = 40,
alpha01 = NULL, alpha02 = 0.5,
bar.ye1 = NULL, bar.ye2 = 3.0,
se1 = NULL, se2 = 2.0
)
cat("Posterior probability with external control:", round(external_continuous, 4), "\n")
#> Posterior probability with external control: 0.0581Next Steps
For more detailed examples and advanced usage:
- See
vignette("binary-endpoints")for comprehensive binary endpoint examples - See
vignette("continuous-endpoints")for detailed continuous endpoint analysis - Visit the package website for additional resources