Statistics & probability

Beta Bernoulli Bayes factor calculator for a point null

Compare a fixed Bernoulli success probability with a proper beta-mixture alternative using marginal likelihood evidence.

Your numbers

Enter a finite value within the stated calculator bounds.
Enter a finite value within the stated calculator bounds.
Positive beta-prior shape fixed before examining these data.
Positive beta-prior shape; both 1 give a uniform alternative over success probabilities.
Enter a finite value within the stated calculator bounds.
Prior model probability, not the beta success-probability mean.

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

Compare a fixed Bernoulli success probability with a proper beta-mixture alternative using marginal likelihood evidence.

THE FORMULAlog BF10=log B(s+a, n−s+b)−log B(a, b)−s log p0−(n−s)log(1−p0).

A worked example

With 65 successes in 100 trials, a uniform beta alternative and p0=0.5, BF10≈11.4614; equal prior model odds give posterior alternative probability≈0.919752.

Good to know

1–1e6 independent Bernoulli trials, integer successes, proper beta parameters 0.01–10000, p0 strictly inside 0 and 1, proper prior model probability. Log evidence retained when exponential output over/underflows. No universal evidence threshold, optional-stopping guarantee or frequentist p-value.

Two models rather than one updated parameter

A point-null model fixes the Bernoulli success probability at p zero. The alternative treats that probability as uncertain under a supplied beta distribution. A Bayes factor compares how well those two complete models predict the observed success and failure counts after averaging over the alternative's prior.

This differs from simply updating a beta posterior or asking for the chance of success in another trial. Model comparison includes a point mass at the null and an averaged alternative. A narrow or broad alternative prior can change that evidence even when the data and posterior mean appear similar.

Evidence updates model oddsPrior model odds 1 : 1Posterior odds ≈ 11.4614 : 1Blue: alternative · Green: point null
Scroll across to see the full diagram.
The default logBF 10≈2.438984 gives BF10≈11.4614; equal prior odds update to posterior odds 11.4614:1.

Compare this with the Beta binomial posterior predictive probability calculator. Compare marginal model evidence for a fixed success probability versus a supplied beta prior, not predict another sample's successes.

Keep the two kinds of prior separate

The beta shapes a and b define uncertainty about the success probability within the alternative model. The prior alternative probability sets how much model probability is assigned to that entire alternative versus the point null. They occupy different levels of the calculation and should not be substituted for one another.

Use positive fixed beta shapes and a null probability strictly between zero and one. The proper-prior condition makes the marginal likelihood well defined. Choosing the alternative prior after inspecting the same counts can materially change interpretation; the calculator does not validate the scientific or procedural origin of your prior.

The sixty-five-of-one-hundred example

The default data have sixty-five successes and thirty-five failures. Under the null probability one-half, every ordered outcome sequence has the same likelihood. Under the uniform beta alternative, the likelihood is integrated across possible success probabilities rather than evaluated only at the sample proportion zero-point-six-five.

The resulting log Bayes factor is about two-point-four-three-eight-nine-eight, corresponding to BF ten of about eleven-point-four-six-one-four. With equal prior model probabilities, posterior alternative probability is BF divided by one plus BF, approximately zero-point-nine-one-nine-seven-five. Other prior model odds change that last probability without changing the Bayes factor.

Why a binomial coefficient cancels

For unordered success counts, both model likelihoods include the same binomial coefficient choosing which trials succeeded. In their ratio that common factor cancels. The implementation therefore uses the corresponding ordered Bernoulli terms, which yield the identical Bayes factor without constructing a potentially enormous combination count.

The beta-mixture marginal term is a ratio of beta functions. Log-gamma arithmetic evaluates it on the logarithmic scale, avoiding overflow from separate large factorial-like values. The page retains the log Bayes factor even when exponentiating it would exceed or fall below the finite floating range.

Evidence and posterior model odds

BF ten greater than one favors the alternative relative to the point null under the two supplied models; a value below one favors the null. Its reciprocal is BF zero-one. Neither direction provides an automatic universal threshold for a scientific conclusion independent of context and prior specification.

Posterior model odds equal prior model odds multiplied by the Bayes factor. Converting those odds to a probability gives the optional model-probability output. It is not the probability that a frequentist null test would reject, and it is not a long-run false-positive rate.

Sampling assumptions still matter

The likelihood assumes independent trials with one common success probability. Dependence, changing probabilities, selective reporting or a data-dependent analysis set can make that model inappropriate. Entering a very large trial count does not repair violations of the exchangeability assumptions behind a beta-Bernoulli comparison.

Stopping and selection procedures need an explicitly defensible probabilistic model. This page does not promise universal immunity to every optional-stopping or reporting scheme. Use the evidence calculation only with a clearly stated sampling question and the same likelihood interpretation used to specify the competing models.

Checks and reporting detail

Exchanging successes and failures while also exchanging beta shapes and replacing p zero by one minus p zero should preserve the evidence ratio. Changing only the prior model probability should leave the Bayes factor unchanged. Those invariances distinguish parameter-prior inputs from model-prior inputs in an exported result.

Report the counts, point null, beta prior and model prior separately. A finite result quantifies relative predictive support under those choices; it does not prove that either model is literally true. Sensitivity to reasonable alternative priors is often more informative than presenting an isolated large numerical evidence value.

A few questions, answered

Is BF10 a p-value?

No. It is a ratio of marginal likelihoods for two specified probabilistic models.

Why does the beta prior matter?

The alternative evidence averages likelihood over that prior rather than using only the best-fitting probability.

Does prior model probability change BF10?

No. It changes posterior model odds after the Bayes factor is calculated.

Can the Bayes factor overflow?

The exponential display can exceed floating range; the log Bayes factor remains the stable output.

Find your calculator

Start typing to explore the library.