07. Beta Distribution — A Probability Distribution over Probabilities
Distribution 2/3. The Beta distribution lives on : it models proportions and probabilities themselves. Background: Gamma and Beta functions, Bayesian inference and conjugacy.
Definition
, :
The normalization constant is the Beta function:
Reading the structure: the density is the product of "the pull toward , " and "the pull toward , ." is the parameter that creates a preference near 1, and creates a preference near 0.
A map of shapes — what the parameters create
| Shape | Interpretation | |
|---|---|---|
| Flat (Uniform) | Complete ignorance | |
| Symmetric bell centered at 0.5 | Belief that it is "half and half"; sharper as the values grow | |
| Peak skewed to the right | More weight on success | |
| U-shaped (diverges at both ends) | Belief in "one of the extremes" (either 0 or 1) | |
| Monotonically decreasing | Preference near 0 | |
| , fixed ratio | Concentrated at one point | Limit of certainty |
A single two-parameter family represents uniform, bell, U, and J shapes. It is effectively a "universal shape library" on , and this expressiveness is the secret of its popularity as a prior.
Moments
They follow immediately from the Beta-type integral pattern.
- The mean is the proportion of success counts. With , the mean is 0.7.
- As (total pseudo-count) grows, the variance shrinks as —the "amount of evidence" tightens the variance.
- When , the mode is . A difference between mean and mode signals asymmetry.
- Because the support is bounded, moments of every order exist. This contrasts with the opposite extreme (alpha-stable) on the hierarchy of moments.
Derivation 1: conjugacy — the state variable of Bayesian inference
A summary of Beta–Bernoulli conjugacy:
- The likelihood and the density kernel have the same algebraic shape, so multiplying them preserves the shape. Conjugacy is another name for this "shape match."
- The posterior mean decomposes into a weighted average of the prior mean and sample proportion:
The formula directly shows how the prior's influence disappears as data accumulates ().
Derivation 2: order statistics — where Beta arises naturally
For the th value obtained by sorting i.i.d. ,
Intuition: for to lie near , values must be on the left (), values must be on the right (), and the number of such combinations becomes the normalization constant. The Beta distribution was not "invented" as a prior; it emerges on its own from order within a uniform distribution. Quantile confidence intervals in nonparametric statistics stand on this fact.
Derivation 3: Gamma ratio representation
For independent ,
- This gives the interpretation of "the relative size of two parts" and is also the standard method for generating Beta random variables (two Gamma samples → ratio).
- Generalizing to parts yields the Dirichlet distribution —a distribution over probability vectors (the simplex). Beta is Dirichlet with . LDA topic models and conjugate priors for multinomial distributions all stand on this generalization.
Applications
Thompson sampling (multi-armed bandits)
For each slot machine , maintain the belief about its success probability as .
- Sample from each arm.
- Pull the arm with the largest .
- On success, += 1; on failure, += 1.
An uncertain arm has high sample variance and occasionally takes the maximum (exploration), while a reliably good arm is selected consistently (exploitation). The exploration–exploitation balance emerges automatically from posterior variance without a separate hyperparameter. It is a standard algorithm for online advertising, recommender systems, and A/B test automation.
A/B testing
Giving the conversion rates their own Beta posteriors lets us estimate directly with Monte Carlo (sample from both and compare). The ability to state the intuitive "probability that B is better" rather than a p-value is an advantage of Bayesian A/B testing.
Other applications
- Confidence intervals for proportions: Clopper–Pearson intervals are expressed using Beta quantiles.
- Project management (PERT): model task duration with a scaled Beta distribution from minimum, mode, and maximum estimates.
- Machine learning: priors for label smoothing and probability calibration.
What to remember from this page
- Beta is a universal two-parameter shape family on —it represents uniform, bell, U, and J shapes.
- are pseudo-counts: the mean is , and a larger total count reduces variance.
- Three independent derivations—Bernoulli conjugacy, uniform order statistics, and a Gamma ratio—reach the same distribution.
- Thompson sampling obtains the exploration–exploitation balance for free by sampling from a Beta posterior.
- Its multivariate generalization is Dirichlet, and Beta is the case.
Next step
- Alpha-Stable Distributions — opposite bounded support, the world where moments disappear