Skip to content

bbssr

2.0.0Package record

Blinded Sample Size Re-Estimation for Binary Endpoints

0packages depend
2.6Kdownloads / year
98.7%test coverage
13/13flavors OK

Overview

About

Tools for blinded sample size re-estimation (BSSR) in two-arm clinical trials with binary endpoints, together with the exact power and sample size calculations that the re-estimation relies on. Five exact statistical tests are implemented: Pearson chi-squared, Fisher exact, Fisher mid-p, Z-pooled exact unconditional, and Boschloo exact unconditional. Each test is available with a one-sided or a two-sided alternative, and the exact unconditional tests can be combined with the Berger-Boos procedure. Sample sizes can be re-estimated either at the planning stage, to study the operating characteristics of a design, or from the blinded data of a trial that is under way. Statistical methods based on Mehrotra et al. (2003) doi:10.1111/1541-0420.00051, Berger and Boos (1994) doi:10.1080/01621459.1994.10476836 and Kieser (2020) doi:10.1007/978-3-030-49528-2_21.

Changes in 2.0.0

This is a major release. It corrects the p-value of the exact unconditional tests, adds

two-sided alternatives, the Berger-Boos procedure and a function for re-estimating the

sample size from observed interim data, and moves the inner loops to compiled code. The

user interface has changed in ways that are not backward compatible, which is why the

major version number has been raised.

Corrections

  • The exact unconditional tests accumulated the null probabilities along an arbitrary ordering of the outcomes. Outcomes sharing the same value of the ordering statistic were therefore split, and could receive different p-values. With N1 = N2 = 7 the outcomes (x1, x2) = (5, 1) and (6, 2) both have a Fisher p-value of 2/39 and cannot be distinguished by the Boschloo test, yet the old code assigned them 0.0216 and 0.0287 and rejected at the first but not the second. Tied values are now grouped explicitly and every member of a group receives the tail probability accumulated up to the last member of that group. The rejection region no longer depends on how the sorting routine breaks ties.
Show all changes in 2.0.0Hide the rest of the changes in 2.0.0
  • The Z-pooled branch indexed the matrix of binomial probabilities by the responder count rather than by the position of that count among the retained values. The two coincided in the configurations reached by the old code, so the results were correct, but the indexing broke as soon as the retained counts were not contiguous.
  • The Boschloo branch discarded outcomes whose Fisher p-value was not below the smallest Fisher p-value among outcomes with a non-positive risk difference. The truncation was sound but had no natural counterpart for a two-sided alternative, and it has been removed. The whole outcome grid is now scanned, which the move to compiled code makes affordable.
  • pmin(1, x) with a scalar first argument drops the dim attribute of x. This affected the matrix of p-values returned for a two-sided chi-squared test.
  • The allocation ratio was not preserved by the re-estimation when r was not 1. The interim size of group 1 was ceiling(omega N1) and the second-stage size was ceiling(r N22), so the final size of group 1 was rounded up three separate times and did not equal ceiling(r) times the final size of group 2. With r = 2, N2 = 33 and omega = 0.8 the interim allocation was 53 to 27 rather than 54 to 27, and a re-estimated control group of 40 gave 79 rather than 80 in group 1. Both the interim and the final size of group 1 are now obtained from the size of group 2 by a single ceiling(r ...), and the second stage follows as the difference. The allocation ratio is therefore exact whenever r is a whole number, and as close as whole numbers allow otherwise. Results for r = 1 are unchanged. BinaryBSSR() brings group 1 to ceiling(r N2.final) for the same reason, which also corrects an imbalance that is already present in the observed interim data.

New features

  • All five tests accept alternative = 'greater' (the default, and the behaviour of version 1) or alternative = 'two.sided'. For the conditional tests the two-sided p-value follows the convention selected by tsmethod, either 'minlike', which matches stats::fisher.test, or 'central'. The chi-squared and Z-pooled tests order outcomes by the absolute value of the Z statistic when the alternative is two-sided.
  • The number of grid points used to search over the nuisance parameter of the unconditional tests is now the argument n.grid, which defaults to 100 and reproduces the grid of version 1. A finer grid gives larger p-values and a more accurate test.
  • The Berger-Boos procedure is available through the argument bb.gamma. A positive value restricts the search over the nuisance parameter to an exact Clopper-Pearson confidence interval computed from the observed number of responders, and adds bb.gamma to the resulting p-value. The default of 0 disables the procedure.
  • BinaryBSSR() re-estimates the sample size from the blinded data of a trial that is under way. It takes the interim sample size of each group and the pooled number of responders, and returns the number of patients still to enrol in each group. This complements BinaryPowerBSSR(), which evaluates a re-estimation rule at the planning stage.
  • Every function returns a classed object with a print() method, and BinaryRR(), BinaryPower(), BinarySampleSize() and BinaryPowerBSSR() also have a plot() method. The classes are bbssr_rr, bbssr_power, bbssr_samplesize, bbssr_powerbssr and bbssr_bssr.
  • The plot() methods accept main, sub, xlab, ylab, base_size and colours, so the title, the axis labels, the font size and the palette can be replaced without editing the returned object. A label left at NULL keeps the text built from the object and a label set to NA is dropped. Where a legend is drawn, legend.title and legend.labels rename it, and where a vertical scale is continuous, ylim sets its range through coord_cartesian(), which hides rather than removes the points outside the range. The reference lines are no longer fixed: plot.bbssr_powerbssr() and plot.bbssr_samplesize() take ref.line, and plot.bbssr_samplesize() also takes ref.line.N2. The methods that draw a curve also take show.points, which removes the marker at each evaluated point and leaves the curve alone, so a fine grid stays legible. This matters when Delta.T is 0, since the two power columns of BinaryPowerBSSR() are then rejection probabilities under the null hypothesis and the line belongs at the level of significance rather than at the target power. The defaults reproduce the earlier plots exactly.
  • BinaryPowerBSSR() reports the expected total sample size in a new column E.N, and carries the interim sample sizes as the attributes n1.interim and n2.interim.
  • Arguments are validated, and invalid sample sizes, significance levels, allocation ratios and grid sizes now produce an informative error.

Performance

  • The maximization over the nuisance parameter and the summation of the binomial mass over the rejection region are implemented in C++ through Rcpp.
  • BinaryPowerBSSR() evaluates BinarySampleSize() once per distinct pair of recovered response probabilities and BinaryRR() once per distinct pair of final sample sizes, rather than once per interim outcome.

Interface changes that are not backward compatible

  • The weighted argument of BinaryPowerBSSR() has been removed, along with the weighted design it selected. Calls that supply it will fail with an unused argument error.
  • The asmd.p1 and asmd.p2 arguments of BinaryPowerBSSR() have been removed. They entered the calculation only through the weights of the weighted design, so with that design gone they had no effect on the result. The planning assumption is carried by Delta.A together with the initial sample sizes N1 and N2. Calls that supply them will fail with an unused argument error.
  • BinaryPower() returns a one-row-per-scenario data frame of class bbssr_power rather than a bare numeric vector. Code that used the returned value directly should now read the Power column.
  • BinaryRR() returns a logical matrix carrying the class bbssr_rr and the design settings as attributes. The matrix itself is unchanged, so indexing and sum() behave as before, but printing now goes through print.bbssr_rr().
  • BinarySampleSize() and BinaryPowerBSSR() gained columns in their output, and BinarySampleSize() returns integer rather than double sample sizes.
  • restricted now defaults to FALSE in BinaryPowerBSSR() instead of having no default.
  • ggplot2 and Rcpp have moved into Imports, so a compiler is required to install the package from source.

Documentation

  • The vignettes have been rewritten and a fourth has been added. bbssr-introduction covers the whole package, bbssr-statistical-methods derives the tests and the re-estimation rules, bbssr-interim-reestimation follows a single trial from planning to the interim decision, and bbssr-validation compares the package against stats, Exact and exact2x2 and reports timings.
  • The test suite has been rewritten around reference implementations that follow the definitions of the tests directly, so the p-values are checked against a direct evaluation rather than against stored values.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 3.9 min · r-devel-windows-x86_64
Status changes
  • OK13 OK2026-09-08
  • ERROR12 OK, 1 ERROR2026-09-07
  • OK13 OK2026-08-05
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK14 OK2026-03-10
Advisories

none known

Documentation

In release 2.0.0
README· In the repository, left out of the releaseVignettesYes · 4 · dynamicNEWSYes · 100% structured · mentions 2.0.0Citation fileNo
Help pages
15 (1 internal)includes a package overview page
Examples that run
86%12 run in a plain check · 2 only when donttest examples are enabled (R CMD check --as-cran)
Exported functions with examples
100%
Documented parameters
100%
Return-value docs
100%
Help pages citing references
0%

Downloads

2.6K
CRAN downloads in the past year
Rank #12,274 · ~7/day · ~218/mo
Daily download trend is not available in this view yet.
36930 days
89890 days
2.6K1 year
Compare downloads with other packages →
Also on140 r2u47 autocran

Repository

2Stars
0Forks
0Open issues
0Open PRs
0Releases
86Commits
1Commit identities
clinical-trialspower-calculationsample-size-calculationbinary-endpoints
86 commits · Last activity 2026-10-08 · 0% stars, 30d · Default branch at 2.1.0, ahead of CRAN 2.0.0 (checked 2026-10-18)
Responsiveness
not measured

Stars over time

2026-03-11 · 12026-07-07 · 2
PracticesBeta

10 development-tooling and community-health practices detected across 5 families in the upstream repository

Checks run against github.com/gosukehommaex/bbssr on 2026-10-18.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Docs source (4)
README.Rmdpkgdown

GitHub Pages site last deployed 2026-10-08 · The repository has a site deploy workflow

Coverage (1)
Coverage reporting (Codecov)
CRAN release process (2)
cran-comments.mdCRAN-SUBMISSION
Show all practicesHide 1 practice
Lint, format, editor (1)
RStudio project
How this is detected·Detection ruleset v3 (2026-09-26)

Dependencies

Declared dependencies
10 external dependencies (excludes base and recommended)

Installing bbssr adds 19 packages (8 with compiled code, 15 MB of source tarballs). Heaviest: ggplot2 6.0 MB, Rcpp 1.8 MB, isoband 1.5 MB.

Depends (1)
R >= 3.5.0
Imports (5)
LinkingTo (1)
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

People & History

People (1)
Author, Maintainer since 1.0.2 (2025)
Releases (2)

Pick two releases to compare their code metrics.

  • R
    R 4.6.0 released · 2026-04-24
  • 2.0.0Latest
    record
    2025-06-18 · current release · diff ↗ ·
    added 1 export
    BinaryBSSR
  • 1.0.2
    record
    2025-06-18
  • R
    R 4.5.0 released · 2025-04-11

Package metadata

First published
2025-06-18
Total releases
2 / 1 yrs
License
MIT + file LICENSE OSI
Minimum R
≥ 3.5.0
Download size
635 KB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("bbssr")
Homma, G. (2026). bbssr: Blinded Sample Size Re-Estimation for Binary Endpoints (Version 2.0.0) [Computer software]. https://doi.org/10.32614/CRAN.package.bbssr

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for bbssr version 2.0.0 [Data set]. HJJB, LLC. Data release v2026-10-21. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-21, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy