BCompare groups · Guide test 290
Maximized sequential probability ratio test
Sequentially compares a null with a composite alternative using maximized likelihood and calibrated boundaries.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- Sequential probability ratio tests — Wald SPRT, MaxSPRT and conditional MaxSPRT — Can I decide after every observation (or event) while keeping the planned error rates?
In Sequential probability ratio tests — Wald SPRT, MaxSPRT and conditional MaxSPRT, choose Test = MaxSPRT (Poisson surveillance, unknown elevation).
Do it in CodeSplash Run this test on your own data, in Python or R.
Bench
Change the design, drag the data, move α. The statistic, its reference distribution and the verdict follow.
Bench · Maximized SPRT
Monitoring stops when this many events were expected under H₀.
1 is H₀: events arrive at the expected rate.
Your data
Events arrive over the surveillance periodAt each event the log-LR compares the events so far with the number expected; a signal is the first event above the critical value (none before the minimum count).
If H₀ were true
- The reference: how LLR varies across samples when H₀ is true, the largest log-LR over the surveillance under H₀ (exact) (sequential p: the exact α of a design whose critical value equals your largest log-LR).
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .001).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- events observed and expected under H₀ by time t
- the critical value that keeps P(any signal by T) at α, exactly (Kulldorff et al. 2011)
The verdict
LLR = 7.37, p = .001
p ≤ α = .050: reject H₀
Built for repeated looks at accumulating safety data; its p is the smallest α at which this path would have signaled. The surveillance length and minimum count are part of the design.
- Statistic
- 7.367
- p-value
- 0.0010
Maximized SPRT on 23 events over 10 expected: LLR = 7.37, p = .001. The p-value is below α = .050, so the data are hard to reconcile with H₀.
Question and hypotheses
H0: event risk equals a specified baseline; H1: risk is elevated by some unknown factor.
Assumptions
A specified Poisson/binomial monitoring model, reliable baseline, planned surveillance horizon and observation schedule.
Formula
Parameters and notation
ct observed events,μt expected baseline events to time t; this is the one-sided Poisson maximized likelihood ratio. Binomial MaxSPRT has a binomial likelihood analogue.
Structure of the method
At each surveillance time, compare the null event model with the likelihood maximized over elevated risk and evaluate the resulting log likelihood ratio. A sequentially calibrated upper boundary accounts for repeated inspection over a finite monitoring horizon; a fixed-time chi-square cutoff is not an adequate substitute.
Estimated and nuisance parameters
Observed cumulative events and expected null exposure-events are input/state quantities. The elevated risk ratio is estimated by likelihood maximization at each look when above one. The assumed baseline rate may be externally estimated, but treating it as known is a substantive model assumption.
Settings and design choices
Specify Poisson or binomial formulation, maximum horizon, minimum event count, first-look delay and continuous/group look schedule. Sequential::CV.Poisson SampleSize is the maximum expected number of events under the null, not the number of people. The example calculates a critical value rather than analyzing a complete event stream.
Fitting and adaptation
Recompute the design boundary when the horizon or schedule changes using the supported calibration. Assess baseline-rate reliability before monitoring; use a conditional/historical-uncertainty method when appropriate. There is no neural fine-tuning, and maximizing the alternative does not authorize post hoc tuning of the surveillance design.
Sensitivity and robustness
Baseline drift, overdispersion, outcome misclassification and delayed reporting can distort the Poisson reference. Minimum-event requirements alter early-signal behavior and power. Record actual exposure, increments and look times; sensitivity analyses should include plausible risk/model misspecification rather than only the fitted alternative risk ratio.
How to use and calibrate
Reject at the first crossing of a sequentially calibrated boundary for the maximum horizon, minimum events and look schedule.
Example application
Monitor whether an adverse-event count exceeds baseline during surveillance.
Interpretation and pitfalls
Watch out
Maximizing the alternative changes the boundary from a simple SPRT. A fixed-time χ² threshold does not control repeated looks.
What changed in edition 2
- New sections: structure of the method, estimated and nuisance parameters, settings and design choices, fitting and adaptation, sensitivity and robustness.
Python and R
Design/calibration example: computes a continuous-surveillance MaxSPRT boundary up to 10 expected null events, requiring at least 3 events. The returned critical value is not a p-value for a supplied dataset.
Not run — Python launcher syntax checked; R backend runtime not verified · needs Python standard library + Rscript; R packages: Sequential
# Python launcher for the complete R implementation below.
# Requires Rscript on PATH and the listed R packages.
import shutil
import subprocess
rscript = shutil.which("Rscript")
if rscript is None:
raise RuntimeError("Install R and make Rscript available on PATH.")
r_code = r"""
print(Sequential::CV.Poisson(SampleSize=10,M=3,alpha=.05))
"""
# No shell interpolation. A failed R execution raises an error in Python.
result = subprocess.run([rscript, "--vanilla", "-"], input=r_code,
text=True, capture_output=True)
print(result.stdout)
if result.stderr:
print(result.stderr)
result.check_returncode()
Not run — Syntax checked; runtime not verified in the final environment · needs Sequential
print(Sequential::CV.Poisson(SampleSize=10,M=3,alpha=.05))
Sources
- Sequential — Sequential · CV.PoissonAuthor documentation/source reviewed: Sequential 4.6.3.search.r-project.org
- CV.Poissonsearch.r-project.org
- Statistics guide v4 (historical):
- Python: Python launcher syntax checked; R backend runtime not verified · R: Syntax checked; runtime not verified in the final environment
- Reference's record:
- Edition 2 review: Python: skip · R: not executed (Rscript unavailable); why not run: Python: Python-to-R bridge; Rscript is unavailable. R code was not executed. Python: Not run in the reference's review: Python-to-R bridge; Rscript is unavailable. R code was not executed. R: Reviewed but not run: R wasn't available to the reference's authors.
From the CodeSplash statistics guide (v4), entry 290, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT290.