Statistics & probability

Sequential probability ratio test calculator for Bernoulli trials

Follow Bernoulli log likelihood ratios between two fixed hypotheses and stop at the first selected Wald boundary crossing.

Your numbers

Enter 1–500 zeros and ones separated by commas or spaces. Later values after the first boundary crossing are ignored.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

A Bernoulli sequential probability-ratio test compares two fully specified success probabilities as ordered binary observations arrive. Each success and failure contributes a fixed increment to the log likelihood ratio. Values favoring H1 move the statistic upward, while values favoring H0 move it downward. This calculator traces that evidence until it first reaches a Wald boundary or exhausts the supplied prefix, and explicitly ignores later pasted observations after stopping.

THE FORMULAlog LR_n=Σ[x_i ln(p1/p0)+(1−x_i)ln((1−p1)/(1−p0))]; stop outside the Wald boundaries.

A worked example

Let H0 have p0=0.5, H1 have p1=0.75, alpha=0.05 and beta=0.1. The upper log boundary is ln(18)≈2.89037176. Eight consecutive successes give 8ln(1.5)≈3.24372086, crossing that boundary at trial eight. Two zeros pasted after those successes are not used to reverse the stopped decision. Four consecutive failures would instead cross the lower boundary ln(2/19)≈−2.25129180.

Good to know

Supports 1–500 ordered Bernoulli observations with fixed, distinct p0 and p1 strictly between zero and one. Trials must be IID under each simple hypothesis. Wald nominal error targets are approximate when discrete likelihood-ratio jumps overshoot boundaries; actual errors are not certified here. A finite prefix can reach neither boundary. Hypotheses and stopping rules must be predeclared, not selected after inspecting outcomes.

The order can change the stopping time even when final totals agree

An early run of successes can cross a boundary before later failures occur. Rearranging the same final counts can therefore produce a different stopping time or leave the path undecided over the available prefix. The table preserves collection order and stops at the first crossing. Continuing to accumulate values after that point would describe a different rule from the sequential experiment specified at the start.

The log scale avoids multiplying many tiny likelihoods and makes the two fixed Bernoulli increments visible. When p1 is below p0, failures rather than successes favor H1, but the same likelihood-ratio definition applies. The calculator supports either direction without silently swapping hypothesis labels. A negative log ratio favors H0 relative to H1; it is not a negative probability.

Eight successes cross the upper Wald boundary before two later failures are consideredEight successes reach the H1 boundaryH1H0Stop at 8; ignore later observations
For p0=0.5,p1=0.75,alpha=0.05,beta=0.1, eight successes reach log LR≈3.2437209, above upper boundary ln(18)≈2.8903718. The lower boundary is ln(2/19)≈−2.2512918. Stop at trial eight.

The Exact binomial test calculator with two-sided p-value concerns a fixed sample size. Repeatedly inspecting that p-value does not reproduce this sequential stopping rule.

A boundary decision is conditional on the two proposed models

Reaching the H0 boundary does not prove that p0 is the true population probability. The actual process may differ from both proposed hypotheses, or independence may fail. Likewise, a boundary for H1 does not identify a posterior probability that H1 is correct. Report the hypotheses, nominal error targets and stopping time with the decision so that the meaning of the likelihood comparison remains visible.

The conventional boundaries use beta/(1−alpha) and (1−beta)/alpha. With discrete binary increments, the path generally overshoots rather than lands exactly on a boundary, so nominal error targets should not be advertised as exact realized error rates. The fixed-sample exact binomial test is a different analysis. Repeatedly applying it until a desired p-value appears does not reproduce this predeclared sequential procedure.

A few questions, answered

What if no boundary is reached?

The supplied prefix is undecided under the stated rule. The page reports that status rather than forcing a conclusion from the sign of the final log ratio.

Can I choose p1 after seeing the sequence?

That changes the testing procedure. This calculator assumes two fixed hypotheses and fixed stopping boundaries chosen before examining the observations.

Find your calculator

Start typing to explore the library.