| Title: | Bayesian Decision-Making for Clinical Trials |
| Version: | 0.1.0 |
| Maintainer: | Jiangyan Zhao <zhaojy2017@126.com> |
| Description: | Provides tools for Bayesian decision-making in single-arm phase II clinical trials with binary efficacy endpoints. Uses Beta-binomial models to calculate posterior probabilities that the response rate exceeds a prespecified reference value and to estimate predictive probabilities of meeting final-analysis success criteria. Evaluates the frequentist operating characteristics of two-stage designs with posterior-probability-based stopping rules, including type I error rates, statistical power, and probabilities of early stopping for efficacy or futility, using Monte Carlo simulation. For methodological background, see Thall and Simon (1994) <doi:10.2307/2533377> and Lee and Liu (2008) <doi:10.1177/1740774508089279>. |
| License: | GPL (≥ 3) |
| URL: | https://github.com/Jiangyan-Zhao/BayesianTrial |
| BugReports: | https://github.com/Jiangyan-Zhao/BayesianTrial/issues |
| Encoding: | UTF-8 |
| NeedsCompilation: | no |
| Depends: | R (≥ 3.5.0) |
| Imports: | stats |
| Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) |
| VignetteBuilder: | knitr, rmarkdown |
| Config/roxygen2/version: | 8.1.0 |
| Config/testthat/edition: | 3 |
| Packaged: | 2026-11-01 14:01:28 UTC; JYZHAO |
| Author: | Jiangyan Zhao [cre, aut], Rongji Mu [aut, cph] |
| Repository: | CRAN |
| Date/Publication: | 2026-11-19 11:30:24 UTC |
Operating Characteristics of a Two-Stage Single-Arm Phase II Trial
Description
Evaluates the operating characteristics of a two-stage single-arm phase II trial with a binary efficacy endpoint and prespecified posterior-probability stopping rules. Monte Carlo simulation is used to estimate the probability of trial success and early stopping probabilities for efficacy and futility.
Usage
oc_singlearm_binary(
theta_true,
n_current,
N_total,
alpha0 = 0.2,
beta0 = 0.8,
theta0_null = 0.2,
gamma_early = 0.98,
gamma_futility = 0.5,
gamma_final = 0.95,
ntrial = 10000,
seed = 666
)
Arguments
theta_true |
Assumed true treatment response rate for generating trial outcomes; a probability between 0 and 1. Specify the null-scenario rate to assess the type I error rate or a clinically promising alternative rate to assess power. |
n_current |
Planned number of patients with evaluable outcomes at the single interim
analysis; a non-negative integer not exceeding |
N_total |
Planned maximum number of evaluable patients; a non-negative integer at
least as large as |
alpha0, beta0 |
Positive, finite shape parameters of the Beta prior for the response rate. Their sum must also be finite. |
theta0_null |
Prespecified unacceptable or historical reference response rate used as the primary efficacy benchmark; a probability between 0 and 1. |
gamma_early |
Interim posterior probability cutoff for early declaration of efficacy; a
probability between 0 and 1. An early positive result is
declared if the posterior probability of exceeding |
gamma_futility |
Interim posterior probability cutoff for stopping due to futility; a
probability between 0 and 1 and strictly less than
|
gamma_final |
Posterior probability cutoff for declaring a positive result at the final analysis if the trial continues; a probability between 0 and 1. |
ntrial |
Positive integer number of independently simulated trials. |
seed |
Optional integer seed for reproducibility. |
Value
A named list containing:
- power_null_post
Estimated overall probability of declaring a positive trial result, including early efficacy stopping. Interpreted as type I error probability under a null scenario or as power under a specified alternative.
- early_stop_rate_futility
Estimated probability of stopping the trial at the interim analysis for futility.
- early_stop_rate_efficacy
Estimated probability of stopping the trial at the interim analysis for efficacy.
References
Zhao, J., and Mu, R. (2026). Introduction to Bayesian Decision Method and Its Application in Medical Research. Manuscript in preparation (in Chinese).
Thall, P. F., and Simon, R. M. (1994). Practical Bayesian guidelines for phase IIB clinical trials. Biometrics, 50, 337–349. doi:10.2307/2533377.
Lee, J. J., and Liu, D. D. (2008). A predictive probability design for phase II cancer clinical trials. Clinical Trials, 5, 93–106. doi:10.1177/1740774508089279.
See Also
posterior_predictive_singlearm_binary
Examples
null_oc <- oc_singlearm_binary(
theta_true = 0.20, n_current = 20, N_total = 40
)
alternative_oc <- oc_singlearm_binary(
theta_true = 0.40, n_current = 20, N_total = 40
)
null_oc$power_null_post # Type I error probability at the null rate
alternative_oc$power_null_post # Power at the alternative rate
Posterior and Predictive Probabilities for a Single-Arm Phase II Trial
Description
Calculates posterior summaries of the treatment response rate and predictive probabilities of meeting prespecified final-analysis efficacy criteria in single-arm phase II trials with binary endpoints.
Usage
posterior_predictive_singlearm_binary(
x_obs,
n_current,
N_total,
alpha0 = 0.2,
beta0 = 0.8,
theta0_null = 0.2,
theta0_clin = 0.4,
gamma_final = 0.95,
gamma_clin_final = 0.9,
S = 10000,
type = c("posterior", "predictive", "both"),
seed = 666
)
Arguments
x_obs |
Number of observed responses among |
n_current |
Number of patients with evaluable outcomes at the
current analysis; a non-negative integer no greater than |
N_total |
Planned maximum number of patients with evaluable outcomes;
a non-negative integer at least as large as |
alpha0, beta0 |
Positive shape parameters of the Beta prior for the response rate. |
theta0_null |
Prespecified historical reference or unacceptable response rate; a probability between 0 and 1. |
theta0_clin |
Clinically meaningful target response rate for a supplementary predictive assessment; a probability between 0 and 1. |
gamma_final |
Final posterior probability threshold for trial success
relative to |
gamma_clin_final |
Final posterior probability threshold for the
supplementary criterion relative to |
S |
Positive integer number of Monte Carlo replications used to estimate predictive probabilities. |
type |
Results to return: |
seed |
Optional integer seed for reproducibility. |
Value
A named list containing the components specified by type.
The default returns posterior summaries; "predictive" returns
predictive probabilities; "both" returns all components:
- posterior
Shape parameters
alphaandbetaof the current Beta posterior.- posterior_mean
Posterior mean of the response rate.
- posterior_sd
Posterior standard deviation of the response rate.
- p_null
Posterior probability that the response rate exceeds
theta0_null.- ppos_null
Predictive probability of meeting the final efficacy criterion defined by
theta0_nullandgamma_final.- ppos_clin
Predictive probability of meeting the supplementary criterion defined by
theta0_clinandgamma_clin_final.
Predictive probabilities are estimated by Monte Carlo simulation,
conditional on the observed data and completion of the planned
sample size N_total.
References
Zhao, J., and Mu, R. (2026). Introduction to Bayesian Decision Method and Its Application in Medical Research. Manuscript in preparation (in Chinese).
Thall, P. F., and Simon, R. M. (1994). Practical Bayesian guidelines for phase IIB clinical trials. Biometrics, 50, 337–349. doi:10.2307/2533377.
Lee, J. J., and Liu, D. D. (2008). A predictive probability design for phase II cancer clinical trials. Clinical Trials, 5, 93–106. doi:10.1177/1740774508089279.
See Also
Examples
posterior <- posterior_predictive_singlearm_binary(
x_obs = 9, n_current = 20, N_total = 40
)
posterior$p_null
predictive <- posterior_predictive_singlearm_binary(
x_obs = 9, n_current = 20, N_total = 40,
type = "predictive"
)
predictive$ppos_null
both <- posterior_predictive_singlearm_binary(
x_obs = 9, n_current = 20, N_total = 40,
type = "both"
)
both