How this calculation works
Fit a logit mean with common concentration to independent grouped successes and trial counts. Estimate overdispersion, fitted success probabilities and count variances with a bounded beta-binomial likelihood.
μᵢ=logistic(xᵢᵀβ), αᵢ=μφ, βshapeᵢ=(1−μ)φ; P(Y=y)=choose(n,y)B(y+α,n−y+βshape)/B(α,βshape); ρ=1/(φ+1).A worked example
Fifty displayed groups of twenty trials give coefficients [−0.236580019, 0.272058290], concentration 7.246316916 and intraclass correlation 0.121266259.
Good to know
20–200 independent successes/trials rows, integer trials 2–10000 and 0≤successes≤trials; 1–3 explicit design columns including any intercept, entries within ±20. Common concentration exp(logφ), −5<logφ<10; coefficients within ±15; three local starts and interior score/curvature checks. Reject unresolved binomial/dispersion boundaries. No intervals, varying dispersion, zero inflation, correlated groups or global-optimum guarantee.
Reference: SciPy: beta-binomial probability mass function (opens in a new tab) ↗
Keep the grouping visible
A grouped success count combines a numerator and a known number of opportunities. Groups with the same underlying mean can vary more than an ordinary binomial permits. A beta-binomial model represents that extra variation by allowing the latent success probability to differ between independent groups.
This regression models the mean probability with a logistic linear predictor and uses one common positive concentration. It estimates those quantities from repeated groups. It does not ask for a prior distribution to update from a single pooled observation, and its dispersion parameter has a sampling-model interpretation.
Compare this with the Beta binomial posterior predictive probability calculator. Estimate predictor-dependent success probabilities with between-group overdispersion,not a posterior predictive probability from one supplied beta prior.
Enter successes and trials together
Each observation row contains successes followed by trials. Counts must be integers, trials must be at least two, and successes must lie between zero and trials inclusive. Groups with zero successes or all successes are valid; a denominator of zero is not an observed binomial experiment.
Design rows align with the grouped observations. The interface uses explicit columns, including a column of ones if an intercept is wanted. Fifty default groups each have twenty trials, with one predictor spanning minus one to one. Equal denominators simplify inspection but are not required by the method.
Translate mean and concentration into shapes
For a fitted mean mu and concentration phi, the beta shapes are mu times phi and one minus mu times phi. Both remain positive. The count likelihood includes the binomial coefficient and a ratio of beta functions, evaluated on a logarithmic scale to avoid multiplying tiny probabilities.
The induced within-group correlation is one divided by phi plus one. Larger concentration approaches the ordinary binomial limit; smaller concentration gives greater between-group variability. This parameterization separates the direction of the mean association from the amount of extra count dispersion at a fixed mean.
Read the numerical demonstration
The supplied groups yield an intercept of approximately minus 0.236580 and a predictor coefficient of approximately 0.272058. Estimated concentration is approximately 7.246317, corresponding to correlation 0.121266. These are reproducible values from the displayed synthetic groups rather than rounded guesses at an intended population effect.
At predictor zero, applying the logistic transformation to the intercept gives a mean probability near 0.441. For twenty opportunities, the expected number of successes is about 8.82. Extra dispersion affects the variance around that expectation; it does not multiply or otherwise alter the expected count itself.
Compare the fitted count variance
The returned variance is n times mu times one minus mu, multiplied by one plus n minus one times the fitted correlation. Thus groups with larger trial counts may show much greater variance inflation even when they share the same concentration. The corresponding expected successes remain n times mu.
Inspect fitted means across predictor rows before interpreting the coefficient. A unit increase in a predictor multiplies the modeled mean odds by the exponential of its coefficient. That is an association in the mean probability, not an odds ratio for every latent group probability or a causal treatment effect.
Know when dispersion is unresolved
Three deterministic starts search for an interior likelihood fit. The calculator checks the numerical score and local curvature and rejects concentration at its search limits. Data that support only a binomial boundary cannot justify a finite overdispersion estimate simply because a very large number can be printed.
Small samples, nearly constant predictors and too few distinct trial configurations can make concentration weakly identified. Duplicate design columns are rejected. Thirty identical copies of one group do not create independent information if those copies are repeated records from the same experimental unit or administrative cluster.
Report the scope honestly
The bounded fit accepts twenty through two hundred independent groups, up to three explicit design columns, and at most ten thousand trials per group. Coefficients and log concentration have finite numerical bounds. A boundary rejection invites reconsidering model support, scaling and design rather than presenting a spurious precise result.
There are no coefficient intervals, varying-concentration predictors, zero-inflated components, repeated-group correlations or global-optimum guarantee. Preserve the supplied denominators and success definition in any report. Aggregating heterogeneous groups before fitting can erase the very variation that this likelihood was intended to estimate and can change the predictor association.
A few questions, answered
Is concentration a prior strength here?
No. It is estimated as a common dispersion parameter across independent grouped observations. This is a sampling likelihood regression, not a prior update from one group.
Can a group have zero or all successes?
Yes, provided its trial count is valid. The overall dataset still needs an identifiable finite regression and concentration estimate.
What does rho mean?
Rho=1/(phi+1) is the model-implied within-group Bernoulli correlation from beta mixing. It controls count variance inflation relative to binomial sampling.
Why reject very large concentration?
A concentration running toward infinity indicates an unresolved binomial boundary. Reporting a finite search cap would misrepresent that limit as an estimated interior value.