bbssr
is a comprehensive R package designed for blinded sample size re-estimation (BSSR) in two-arm clinical trials with binary endpoints. Unlike traditional fixed-sample designs, BSSR allows for adaptive sample size adjustments during the trial while maintaining the statistical integrity and blinding of the study.
Exact
, exact2x2
) across multiple scenariosThe package implements five exact statistical tests specifically designed for binary endpoints in clinical trials:
'Chisq'
) - One-sided exact test'Fisher'
) - Classical exact conditional test'Fisher-midP'
) - Less conservative alternative to Fisher exact'Z-pool'
) - Unconditional exact test with pooled variance'Boschloo'
) - Most powerful unconditional exact testTraditional clinical trials with fixed sample sizes often suffer from:
BSSR addresses these issues by:
Install the released version from CRAN:
install.packages("bbssr")
Or install the development version from GitHub:
# install.packages("devtools") devtools::install_github("gosukehommaEX/bbssr")
library(bbssr) # Calculate power for a traditional design power_traditional <- BinaryPower( p1 = 0.5, # Response rate in treatment group p2 = 0.2, # Response rate in control group N1 = 40, # Sample size in treatment group N2 = 40, # Sample size in control group alpha = 0.025, # One-sided significance level Test = 'Fisher' # Statistical test ) print(power_traditional)
# Calculate required sample size sample_size <- BinarySampleSize( p1 = 0.5, # Expected response rate in treatment group p2 = 0.2, # Expected response rate in control group r = 1, # Allocation ratio (1:1) alpha = 0.025, # One-sided significance level tar.power = 0.8, # Target power Test = 'Boschloo' # Most powerful exact test ) print(sample_size)Blinded Sample Size Re-estimation
library(dplyr) # BSSR with different design rules bssr_result <- BinaryPowerBSSR( asmd.p1 = 0.45, # Assumed response rate in treatment group asmd.p2 = 0.09, # Assumed response rate in control group p = seq(0.1, 0.9, by = 0.1), # Range of pooled response rates Delta.A = 0.36, # Assumed treatment effect Delta.T = 0.36, # True treatment effect N1 = 24, # Initial sample size in treatment group N2 = 24, # Initial sample size in control group omega = 0.5, # Fraction for interim analysis r = 1, # Allocation ratio alpha = 0.025, # Significance level tar.power = 0.8, # Target power Test = 'Z-pool', # Statistical test restricted = FALSE, # Unrestricted design weighted = FALSE # Non-weighted approach ) head(bssr_result)Advanced Example: Comparing BSSR Designs
library(bbssr) library(dplyr) library(ggplot2) # Compare different BSSR approaches power_comparison <- tibble( Rule = factor( c('Restricted', 'Unrestricted', 'Weighted'), levels = c('Restricted', 'Unrestricted', 'Weighted') ), restricted = c(TRUE, FALSE, FALSE), weighted = c(FALSE, FALSE, TRUE) ) %>% group_by_all() %>% reframe(r = c(1, 2), N1 = c(24, 36), N2 = c(24, 18)) %>% group_by_all() %>% reframe( BinaryPowerBSSR( asmd.p1 = 0.45, asmd.p2 = 0.09, p = seq(0.1, 0.9, by = 0.01), Delta.A = 0.36, Delta.T = 0.36, N1, N2, omega = 0.5, r, alpha = 0.025, tar.power = 0.8, Test = 'Z-pool', restricted, weighted ) ) %>% mutate( Rule = factor(Rule, levels = c('Restricted', 'Unrestricted', 'Weighted')), Allocation = paste0('Allocation ratio = ', r, ':1') ) # Visualize the results ggplot(power_comparison, aes(x = p, y = power.BSSR, color = Rule)) + geom_line(linewidth = 1.2) + facet_wrap(~Allocation) + geom_hline(yintercept = 0.8, color = 'gray', linetype = 'dashed') + labs( x = "Pooled Response Rate (θ)", y = "Power", title = "Power Comparison: BSSR Design Rules", subtitle = "Horizontal line shows target power = 0.8" ) + theme_minimal() + theme(legend.position = "bottom")
The plot above demonstrates how different BSSR design rules perform across various pooled response rates. Key observations:
BinaryPower()
Calculate power for traditional fixed-sample designs BinarySampleSize()
Calculate required sample size for given power BinaryPowerBSSR()
Calculate power for BSSR designs BinaryRR()
Compute rejection regions for exact tests Restricted Design (restricted = TRUE
)
restricted = FALSE
)
weighted = TRUE
)
All methods in bbssr
maintain exact Type I error control at the specified α level. The package implements exact statistical tests rather than asymptotic approximations, ensuring validity even for small sample sizes commonly encountered in clinical trials.
For detailed examples and theoretical background, see:
vignette("bbssr-introduction")
- Getting started guidevignette("bbssr-statistical-methods")
- Statistical methodologyvignette("bbssr-validation")
- Function validation and performance comparisonThis project is licensed under the MIT License - see the LICENSE.md file for details.
Gosuke Homma
Note: This package is designed for use by statisticians and clinical researchers familiar with adaptive trial designs. For regulatory submissions, please consult with biostatisticians and regulatory affairs specialists to ensure compliance with relevant guidelines (FDA, EMA, etc.).
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4