sequential_design: Prespecify a sequential Bayesian analysis design

View source: R/sequential-analysis.R

sequential_designR Documentation

Prespecify a sequential Bayesian analysis design

Description

Creates a frozen specification of a sequential Bayesian analysis before data collection: the model, the analysis priors, the monitored effect, the decision metric, the stopping thresholds, and the planned look schedule. The returned object is used both to simulate the design's operating characteristics (brms_inla_sequential_trial()) and to monitor the real study as data accumulate (sequential_analysis()).

The object carries an MD5 fingerprint of all decision-relevant fields. Quoting this fingerprint in a preregistration or protocol allows readers and reviewers to verify that the stopping rules were not altered after data collection began: any change to the model, priors, metric, thresholds, or look schedule produces a different fingerprint.

Usage

sequential_design(
  formula,
  family = gaussian(),
  priors = NULL,
  effect_name,
  metric = c("direction", "threshold", "rope"),
  alternative = c("greater", "less"),
  looks,
  prob_success = 0.95,
  prob_futility = NULL,
  effect_threshold = 0,
  rope_bounds = NULL,
  credible_level = 0.95,
  label = NULL
)

Arguments

formula

Model formula (brms syntax; random effects supported).

family

Response family, e.g. gaussian(), binomial().

priors

Optional brms prior specification (translated to INLA via the package's prior bridge; see brms_inla_power()).

effect_name

Single character: the monitored fixed effect.

metric

"direction", "threshold", or "rope".

alternative

"greater" or "less": the prespecified direction for the direction/threshold metrics. Ignored for "rope".

looks

Strictly increasing vector of cumulative sample sizes (total observations) at which interim analyses are planned. The final element is the maximum sample size.

prob_success

Scalar or length(looks) vector of stop-for-success posterior probability thresholds in (0.5, 1). Per-look vectors allow stricter early thresholds (O'Brien-Fleming-like behaviour).

prob_futility

Scalar or length(looks) vector of stop-for-futility thresholds in (0, 0.5), or NULL (default) for no futility stopping. Ignored with a warning for metric = "rope".

effect_threshold

Threshold for metric = "threshold" (model coefficient scale).

rope_bounds

Length-2 increasing numeric vector for metric = "rope".

credible_level

Credible level for reported intervals (default 0.95).

label

Optional character label for the study (used in printing).

Details

Because Bayesian posterior quantities obey the likelihood principle, the interpretation of the posterior at the final look does not depend on the stopping rule. The frequency properties of the design (false-go rate, expected sample size, exaggeration of estimates at early stops) do. The recommended workflow is therefore: (1) create the design; (2) estimate its operating characteristics by simulation with brms_inla_sequential_trial(); (3) preregister the design, including its fingerprint; (4) monitor the study with sequential_analysis(); and (5) report the final posterior alongside the simulated operating characteristics.

Value

A list of class "powerbrmsINLA_seq_design" whose fingerprint element contains the MD5 hash of the decision-relevant fields.

See Also

sequential_analysis(), brms_inla_sequential_trial(), plot_sequential_monitor()

Examples

design <- sequential_design(
  formula          = strength ~ group,
  effect_name      = "group",
  metric           = "threshold",
  effect_threshold = 0.2,
  looks            = c(40, 80, 120, 160, 200),
  prob_success     = 0.95,
  prob_futility    = 0.05,
  label            = "Periodisation RCT"
)
print(design)


powerbrmsINLA documentation built on July 2, 2026, 5:07 p.m.