Continuous distribution
Beta distribution
An unknown probability or proportion: a conversion rate, a batting average, the share of a vote. It is the conjugate prior for the Bernoulli and binomial, so after a Beta() prior and successes in trials the posterior is Beta(): the parameters act like prior counts of successes and failures.
Beta probability calculator
P(X ≤ 0.26) = 0.489628
At the parameters set by the sliders. The shaded region on the plot is the probability; the dots on the CDF mark F at its ends.
CDF
mean 0.2857 · variance 0.02551 · sd 0.1597 · mode 0.2 · entropy −0.4845 nats
Formulas
| Parameters | |
|---|---|
| Support | |
| CDF | |
| Mean | |
| Variance | |
| Mode | |
| MGF | |
| Entropy |
Worked example
A new button is clicked by 7 of the first 10 visitors. Starting from a uniform prior on its click rate , what is the probability that ?
The uniform prior is Beta(1, 1), so the posterior is Beta(1 + 7, 1 + 3) = Beta(8, 4), with mean . Then . answer checked by code
How it relates to others
- Transformation← Uniform: The -th smallest of independent Uniform() values is Beta(). checked by code
- Special case→ Uniform: Beta() is Uniform(). checked by code
- Transformation← F: If is F(), is Beta(). checked by code
- Transformation← Gamma: If are independent Gamma() and Gamma() with the same rate, is Beta(). checked by code
- Special case← Dirichlet: Dirichlet with is the beta, and each coordinate of a Dirichlet is Beta(). checked by code
- Conjugate prior→ Binomial: A Beta() prior on and successes in binomial trials give a Beta() posterior. checked by code
- Conjugate prior→ Bernoulli: The beta is the conjugate prior for the Bernoulli , one trial at a time: each success adds 1 to , each failure 1 to .
- Mixture→ Beta-binomial: A Binomial() count whose is itself Beta() is Beta-binomial(). It is also the posterior predictive of a binomial count under a beta prior. checked by code
- Special case→ Arcsine: Beta() is Arcsine(). checked by code
- Special case← Kumaraswamy: Kumaraswamy() is Beta(), and Kumaraswamy() is Beta(). checked by code
All the relationships, as a diagram →
In Python
from scipy import stats
import numpy as np
X = stats.beta(a=2, b=5)
X.pdf(0.3) # f(0.3) = 2.161
X.cdf(0.3) # P(X ≤ 0.3) = 0.5798
X.mean(), X.var() # 0.2857, 0.02551
X.ppf(0.95) # 95th percentile
X.rvs(size=10, random_state=0)
rng = np.random.default_rng(0)
rng.beta(a=2, b=5, size=10)Choosing between this and its neighbours? Which distribution for proportions and probabilities? · Which prior distribution should I use?