Overview
BayesianQDM provides a comprehensive framework for Bayesian Quantitative Decision-Making in clinical trials. The package enables researchers to make Go/NoGo/Gray decisions using posterior and predictive probabilities for both binary and continuous endpoints.
Key Features
- โ Multiple Study Designs: Controlled, uncontrolled, and external control designs
- ๐ Flexible Endpoints: Support for both binary and continuous outcomes
- ๐ข Multiple Calculation Methods: For continuous endpoints (Numerical Integration, Monte Carlo, Welch-Satterthwaite)
- ๐ฏ Three-Zone Decision Framework: Go/NoGo/Gray probability calculation
- ๐ Power Priors: Incorporation of historical/external data
Installation
From CRAN
install.packages("BayesianQDM")Development Version
# install.packages("devtools")
devtools::install_github("gosukehommaEX/BayesianQDM")Quick Start
Binary Endpoint Example
library(BayesianQDM)
# Calculate Go/NoGo/Gray probabilities for binary endpoint
result <- 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)Continuous Endpoint Example
# Calculate Go/NoGo/Gray probabilities for continuous endpoint
result <- pGNGsinglecontinuous(
nsim = 100,
prob = 'posterior',
design = 'controlled',
prior = 'vague',
CalcMethod = 'NI',
theta.TV = 1.5, theta.MAV = 0.5, theta.NULL = NULL,
nMC = NULL, gamma1 = 0.8, gamma2 = 0.3,
n1 = 15, n2 = 15, m1 = NULL, m2 = NULL,
kappa01 = NULL, kappa02 = NULL, nu01 = NULL, nu02 = NULL,
mu01 = NULL, mu02 = NULL, sigma01 = NULL, sigma02 = NULL,
mu1 = 4.0, 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)Documentation
๐ Vignettes
The package includes detailed vignettes with practical examples:
- Introduction to BayesianQDM: Overview and quick start guide
- Binary Endpoints: Detailed examples for binary outcome analysis
- Continuous Endpoints: Comprehensive guide for continuous outcome analysis
๐ Function Documentation
- Full Reference: Complete function documentation with examples
๐ Package Website
Visit our pkgdown website for: - Interactive documentation - Downloadable examples - Method comparisons - Best practice guides
Core Functions
Decision Making Functions
-
pGNGsinglebinary()- Go/NoGo/Gray probabilities for binary endpoints -
pGNGsinglecontinuous()- Go/NoGo/Gray probabilities for continuous endpoints
Probability Calculation Functions
-
pPPsinglebinary()- Posterior/predictive probabilities for binary endpoints -
pPPsinglecontinuous()- Posterior/predictive probabilities for continuous endpoints
Distribution Functions
-
p2betadiff()- CDF for difference of two beta distributions -
p2betabinomdiff()- Beta-binomial posterior predictive probability -
pNI2tdiff()- Numerical integration for t-distribution differences -
pMC2tdiff()- Monte Carlo for t-distribution differences -
pWS2tdiff()- Welch-Satterthwaite approximation for t-distribution differences -
d2betadiff()- Density function for difference of two beta distributions
Utility Functions
-
AppellsF1()- Appellโs hypergeometric function F1
Study Designs
Calculation Methods
For Continuous Endpoints
| Method | Description | Use Case |
|---|---|---|
| NI | Numerical Integration | Most accurate, recommended for final analyses |
| WS | Welch-Satterthwaite | Fast approximation for unequal variances |
| MC | Monte Carlo | Flexible simulation-based approach |
Method Comparison Example
# Compare calculation methods
mu1 <- 3.5; mu2 <- 1.8; sd1 <- 1.3; sd2 <- 1.1; nu1 <- 14; nu2 <- 16
# Numerical integration (exact)
prob_ni <- pNI2tdiff(q = 1.5, mu.t1 = mu1, mu.t2 = mu2,
sd.t1 = sd1, sd.t2 = sd2, nu.t1 = nu1, nu.t2 = nu2)
# Welch-Satterthwaite approximation (fast)
prob_ws <- pWS2tdiff(q = 1.5, mu.t1 = mu1, mu.t2 = mu2,
sd.t1 = sd1, sd.t2 = sd2, nu.t1 = nu1, nu.t2 = nu2)
cat("NI:", round(prob_ni, 4), "WS:", round(prob_ws, 4),
"Diff:", round(abs(prob_ni - prob_ws), 4))Study Design Examples
Controlled Design
Standard two-arm randomized controlled trial.
# Binary endpoint
result <- 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
)Uncontrolled Design
Single-arm study with historical control assumption.
result <- pPPsinglebinary(
prob = 'posterior',
design = 'uncontrolled',
theta0 = 0.15,
n1 = 20, n2 = 20, y1 = 12, y2 = 3.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
)External Control Design
Incorporating historical data using power priors.
result <- 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
)References
For theoretical background and methodology details, please refer to the package vignettes and function documentation.
Citation
To cite BayesianQDM in publications, please use:
Homma, G., Yamaguchi, Y. (2025). BayesianQDM: Bayesian Quantitative
Decision-Making Framework for Binary and Continuous Endpoints.
R package version 0.1.0.
Issues and Contributions
To report bugs or request features, please visit our GitHub repository.
