Skip to content

OptOTrials

1.1.0Package record

Optimal Two-Stage Designs for Ordered Categorical Outcomes

0packages depend
4.4Kdownloads / year
94.5%test coverage
13/13flavors OK

Overview

About

Functions to design and simulate optimal two-stage randomized controlled trials (RCTs) with ordered categorical outcomes, using rank-based tests and interim decision rules for futility and superiority, following Park (2025) doi:10.1371/journal.pone.0318211. The functions 'rule()', 'op()' and 'design_table()' provide a single entry point for constructing designs, evaluating their operating characteristics, and tabulating several designs at once. The separate functions provided for each combination of test statistic and stopping rule up to version 1.0.2 were deprecated in 1.0.3 and are removed here. Please see the package reference manual and the vignette for details.

Changes in 1.1.0

Interface

The many separate design and simulation functions are replaced by two entry

points, in response to the referee reports on the accompanying article.

  • rule() constructs a decision rule. The test statistic (test), the monitoring scheme (stopping) and the optimality criterion (criterion) are arguments.
  • op() evaluates a design by simulation, taking the object returned by rule() and reporting both hypotheses in a single call.
  • design_table() sweeps a set of tests and criteria and returns a data frame.

Both return classed objects with named components and print() methods, so

the output no longer has to be indexed by position.

Removed

Show all changes in 1.1.0Hide the rest of the changes in 1.1.0

The functions below were deprecated in 1.0.3, which warned on every call, and

are removed here. If a script written for 1.0.2 stops working, the replacement is listed below.

  • ruleF() and ruleFS() become rule(..., stopping = "F") and rule(..., stopping = "FS").
  • Decision_rule_S.F(), Decision_rule_M.F() and Decision_rule_W.F() become rule(..., test = "S"/"M"/"W", stopping = "F").
  • Decision_rule_S.FS(), Decision_rule_M.FS() and Decision_rule_W.FS() become rule(..., test = "S"/"M"/"W", stopping = "FS").
  • Decision_rule_S_1stage(), Decision_rule_M_1stage() and Decision_rule_W_1stage() become rule(..., test = "S"/"M"/"W", stopping = "none").
  • op.F(), op.FS() and op.1stage() become op(design, nsim, seed), where design is the object returned by rule().

The helpers p_plus(), p_minus() and pq_fun() are no longer exported.

They are intermediate quantities inside the variance calculations rather than

part of the interface, and they are still used internally.

V_S.over.nk(), QR_fun() and W_W() remain exported and are now documented

with examples. They give the asymptotic variance of the score,

Mann-Whitney-Wilcoxon and win odds statistics, the quantities defined in the

appendix of the accompanying article, and they let a threshold be computed at a

sample size of the user's choosing rather than at the optimal one.

Designs and operating characteristics are unchanged: the new interface

reproduces every value the old one produced, and the package test suite checks

this against the tables published in the article.

Fixed

  • design_table() and print() on an operating-characteristic object now round the expected sample sizes the same way. EN0, ENa and EN are each shown to two decimal places, rounded once from the value actually simulated; EN is no longer recomputed from the already-rounded EN0 and ENa, which made design_table() print a third decimal that op() did not. Because each column is rounded independently, (EN0 + ENa)/2 taken from the printed columns can differ from the printed EN by up to 0.01.
  • The printed operating-characteristic summary no longer reports a Monte Carlo standard error keyed to a nominal level of 0.05, which was wrong for any other choice of alpha. The table already gives the standard error of each rejection probability, computed from that probability.
  • The FS design's continuation probability under the alternative, beta3 = Pr(T1 <= t1s | Ha), was computed for the score test without the factor n1 in the mean of the statistic. The score statistic has mean theta * V * n, unlike the rank-based statistics, whose means do not scale with the sample size, so the omission made the value far too large (0.98 against a true 0.45 in the article's Example 1 configuration). This entered the expected sample size under the alternative and therefore the objective of criteria 2, 3 and 5, so rule(..., test = "S", stopping = "FS") could return a design that did not minimise what it was asked to minimise. The Mann-Whitney-Wilcoxon and win odds expressions were already correct, and the F design does not use this quantity, so neither table in the accompanying article is affected. The internal variable is now named beta3, matching the article's notation, rather than beta2, which denotes beta - beta1 in the F design.

New

  • Input validation on all exported functions: p1 and p2 are checked for numeric type, equal length, at least two categories, absence of missing values, non-negativity, and summation to one within 1e-6.
  • Proportional_odds_assumption() explains itself and warns instead of returning a bare NA.
  • rule() detects a degenerate optimum, warns, and by default substitutes the single-stage design; controlled by on_degenerate.
  • op() reports futility and superiority stopping probabilities separately, with Monte Carlo standard errors on the rejection probabilities, and refuses to simulate an unsubstituted degenerate design unless allow_degenerate.
  • Decision boundaries are reported on an interpretable effect-size scale, the odds ratio for the score test and the win odds for the rank-based tests.
  • A vignette, "Designing two-stage trials with ordered categorical outcomes".
  • An automated test suite under tests/testthat.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 12.9 min · r-oldrel-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 1.1.0
READMENoVignettesYes · 1 · dynamicNEWSYes · 100% structured · mentions 1.1.0Citation fileNoWebsitenot declared in DESCRIPTION
Help pages
10includes a package overview page
Examples that run
100%9 run in a plain check
Exported functions with examples
100%
Documented parameters
92%
Return-value docs
100%
Help pages citing references
10%

Downloads

4.4K
CRAN downloads in the past year
Rank #20,562 · ~12/day · ~365/mo
Daily download trend is not available in this view yet.
20530 days
65090 days
4.4K1 year
Compare downloads with other packages →
Also on72 r2u2 autocran

Dependencies

Declared dependencies
3 external dependencies (excludes base and recommended)

Installing OptOTrials adds no packages beyond those that come with R.

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

Nothing depends on this yet.

People & History

People (3)
Author, Maintainer since 1.0.2 (2025)
Author
Releases (3)

Pick two releases to compare their code metrics.

  • 1.1.0Latest
    record
    2026-09-23 · current release · diff ↗ ·
    removed 17 exports
    ruleF, ruleFS, op.F, op.FS, op.1stage, Decision_rule_S.F, Decision_rule_S.FS, Decision_rule_S_1stage, Decision_rule_M.F, Decision_rule_M.FS, Decision_rule_M_1stage, Decision_rule_W.F, Decision_rule_W.FS, Decision_rule_W_1stage, p_plus, p_minus, pq_fun
  • 1.0.3
    record
    2026-08-31 · diff ↗ ·
    added 3 exports
    rule, op, design_table
  • R
    R 4.6.0 released · 2026-04-24
  • 1.0.2
    record
    2025-09-05
  • R
    R 4.5.0 released · 2025-04-11

Package metadata

First published
2025-09-05
Total releases
3 / 1 yrs
License
GPL-3 OSI
Minimum R
≥ 4.0
Download size
46 KB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("OptOTrials")
Park, Y., Wang, Y., & Xu, Z. (2026). OptOTrials: Optimal Two-Stage Designs for Ordered Categorical Outcomes (Version 1.1.0) [Computer software]. https://doi.org/10.32614/CRAN.package.OptOTrials

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 OptOTrials version 1.1.0 [Data set]. HJJB, LLC. Data release v2026-10-25. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-25, 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