Beta distribution
Beta distribution: a flexible model for proportions and probabilities between 0 and 1. With the default parameters (shape α = 2, shape β = 5) its mean is 0.28571 and its standard deviation 0.15972. Use the simulator below to draw samples and see it take shape.
Simulate it
Change the parameters, then draw random samples. The bars are the samples; the line is the exact density. With more samples the bars settle onto it.
Samples to draw
What is the beta distribution?
The beta distribution lives on the interval from 0 to 1 and takes a huge variety of shapes depending on its two parameters α and β: flat, bell-shaped, U-shaped, or skewed to either side. That makes it the natural choice for anything that is a proportion or a probability.
In Bayesian statistics it is the conjugate prior for a binomial probability: start with a Beta(α, β) belief about a conversion rate, observe s successes and f failures, and the updated belief is simply Beta(α + s, β + f).
Where it is used
- A conversion rate or click-through rate that is itself uncertain.
- A prior and posterior for the probability in a binomial experiment.
- Proportions of a population that share a property.
- Task completion fractions in project planning (PERT).
- Batting averages and other success rates.
Shape and parameters
With α = β = 1 it is the uniform distribution. When α and β are both above 1 it is a hump with its peak near (α − 1)/(α + β − 2); both below 1 gives a U shape; α > β skews the mass towards 1. The mean is α/(α + β), and the larger α + β is, the more concentrated the distribution.
What it assumes
- Values strictly between 0 and 1.
How it relates to other distributions
- Uniform distribution: Beta(1, 1) is uniform on [0, 1].
- Binomial distribution: The beta is the conjugate prior for the binomial probability.
- Gamma distribution: If X and Y are independent gammas, X/(X + Y) is beta.
Common mistakes
- Using it for quantities that can fall outside 0 to 1 without rescaling.
- Reading α and β as counts: they are 'pseudo-counts' of successes and failures, and the prior counts matter less as data arrives.
How to work it out
- 1
The probability density function (the formula that gives the shape):
- 2
Its mean (the long-run average) and variance (the spread):
- 3
Worked example with the default parameters (shape α = 2, shape β = 5): With α = 2 and β = 5, what is the probability that the proportion is above 0.5?
LaTeX source of the formulas on this page
\[ f(x)=\frac{\Gamma(\alpha+\beta)}{\Gamma(\alpha)\Gamma(\beta)}\,x^{\alpha-1}(1-x)^{\beta-1} \]
\[ \mu = \frac{\alpha}{\alpha+\beta},\qquad \sigma^2 = \frac{\alpha\beta}{(\alpha+\beta)^2(\alpha+\beta+1)} \]
\[ \text{answer} = 0.1094 \]At a glance
| Property | Value |
|---|---|
| Type | Continuous (measurements) |
| Parameters | shape α; shape β |
| Possible values | 0 to 1 |
| Mean | 0.28571 |
| Variance | 0.02551 |
| Standard deviation | 0.15972 |
| Example (shape α = 2, shape β = 5) | With α = 2 and β = 5, what is the probability that the proportion is above 0.5? Answer: 0.1094. |
How to compute it in Excel, Python and R
| Tool | Function |
|---|---|
| Excel / Google Sheets | =BETA.DIST(x, α, β, TRUE) |
| Python (SciPy) | scipy.stats.beta.cdf(x, a, b) |
| R | pbeta(x, shape1, shape2) |
Questions
What is the beta distribution used for?
A flexible model for proportions and probabilities between 0 and 1. Typical uses: A conversion rate or click-through rate that is itself uncertain. A prior and posterior for the probability in a binomial experiment. Proportions of a population that share a property.
What are the mean and variance of the beta distribution?
Mean: μ = (α)/(α+β). Variance: σ² = (αβ)/((α+β)²(α+β+1)).
What does the beta distribution assume?
Values strictly between 0 and 1.
How do I calculate it in Excel?
=BETA.DIST(x, α, β, TRUE)
How is the beta distribution related to other distributions?
Uniform distribution: Beta(1, 1) is uniform on [0, 1]. Binomial distribution: The beta is the conjugate prior for the binomial probability. Gamma distribution: If X and Y are independent gammas, X/(X + Y) is beta.