Beta Distribution Calculator
Explore a beta distribution by setting alpha and beta, or switch to Lognormal and enter μ and σ of log(X). Plot the density, calculate interval probabilities, moments and quantiles, and compare seeded sample draws that you can download as CSV.
Alpha and beta each from 0.1 to 100. Below 1, the density is infinite at that end.
| x | model | draws |
|---|---|---|
| 0 to 0.1 | 0.114265 | - |
| 0.1 to 0.2 | 0.230375 | - |
| 0.2 to 0.3 | 0.235185 | - |
| 0.3 to 0.4 | 0.186895 | - |
| 0.4 to 0.5 | 0.123905 | - |
| 0.5 to 0.6 | 0.068415 | - |
| 0.6 to 0.7 | 0.030025 | - |
| 0.7 to 0.8 | 0.009335 | - |
| 0.8 to 0.9 | 0.001545 | - |
| 0.9 to 1 | 5.50000e-5 | - |
- mean
- 2/7 = 0.285714
- variance
- 5/196 = 0.025510
- SD
- 0.159719
- median
- 0.264450
- mode
- 1/5 = 0.200000
- skewness
- 0.596285
- excess kurtosis
- -0.120000
P(0.1 < X < 0.4) = 0.652455
CDF(0.4) - CDF(0.1) = 0.766720 - 0.114265
x = 0.264450
round trip: CDF(0.264450) = 0.500000, relative gap 2.2e-16
Drawing once the page has loaded.
Common questions
- What do alpha and beta do to the shape of a beta distribution?
- The mean is α/(α + β), and the variance is αβ/((α + β)²(α + β + 1)). Keeping the ratio α:β fixed while increasing α + β leaves the mean unchanged and tightens the distribution around it. Equal values give a symmetric curve, and α = β = 1 is the flat uniform distribution. A shape below 1 makes the density infinite at its end: α below 1 at x = 0, β below 1 at x = 1, and the lab labels that end instead of drawing a finite peak. With whole-number shapes the mean and variance are also shown as exact fractions, such as 2/7 and 5/196 for Beta(2, 5).
- What are the beta distribution PDF and CDF?
- For 0 < x < 1, the probability density is f(x) = x^(α - 1)(1 - x)^(β - 1) / B(α, β), where B(α, β) = Γ(α)Γ(β) / Γ(α + β). The CDF is F(x) = I_x(α, β), the regularized incomplete beta function. PDF here means probability density function, not a downloadable document. Choose two interval bounds to calculate F(upper) - F(lower); density at one point is not a point probability.
- Does the continuous beta distribution have a PMF?
- No. A beta distribution with positive α and β is continuous, so it has a probability density function (PDF), not a probability mass function (PMF). For every exact value x, P(X = x) = 0, including x = 0 and x = 1 even when the density diverges there. Probabilities come from areas over intervals. The discrete beta-binomial distribution has a PMF, but it is a different model.
- How are the beta mean and variance proved?
- For α > 0 and β > 0, integrating x times the beta density gives E[X] = B(α + 1, β) / B(α, β) = α/(α + β). Integrating x² times the density gives E[X²] = B(α + 2, β) / B(α, β) = α(α + 1)/((α + β)(α + β + 1)). These ratios follow from B(α, β) = Γ(α)Γ(β)/Γ(α + β) and Γ(t + 1) = tΓ(t). Set s = α + β. Subtracting E[X]² from E[X²] gives Var(X) = α((α + 1)s - α(s + 1))/(s²(s + 1)) = αβ/(s²(s + 1)). For α = 2 and β = 5, E[X] = 2/7, E[X²] = 3/28 and Var(X) = 5/196.
- How is the beta distribution mode proved, including boundary cases?
- On 0 < x < 1, log f(x) = (α - 1) ln x + (β - 1) ln(1 - x) - ln B(α, β). Its derivative is (α - 1)/x - (β - 1)/(1 - x). For α > 1 and β > 1, setting it to zero gives x = (α - 1)/(α + β - 2); the second derivative, -(α - 1)/x² - (β - 1)/(1 - x)², is negative, so this is the unique peak. Otherwise the derivative gives the boundary cases: if α ≤ 1 and β ≥ 1, excluding α = β = 1, the density decreases toward its peak at 0; if β ≤ 1 and α ≥ 1, excluding α = β = 1, it increases toward its peak at 1. If both shapes are below 1, the density diverges at both ends and there is no unique mode. If α = β = 1, the density is flat and every point is equally high. A boundary peak is infinite when its corresponding shape is below 1, and it never creates a point mass. For Beta(2, 5), the unique mode is 1/5.
- What is an illustrative beta distribution example in real life?
- The proportion of the sky covered by cloud in a photograph is a value between 0 and 1. As an illustration, assume that proportion X follows Beta(2, 5). Select Beta, enter alpha 2 and beta 5, then set the interval from 0 to 0.5. The lab gives mean 2/7 (about 0.285714), variance 5/196 (about 0.025510) and P(0 < X < 0.5) = 57/64 = 0.890625. These shapes are assumed for the example; they were not fitted to cloud observations and the result is not a weather forecast.
- What are μ and σ in a lognormal distribution?
- They are the mean and standard deviation of log(X), not of X. The median of X is e^μ, the mean is e^(μ + σ²/2) and the mode is e^(μ - σ²). The log x view plots the density of log X, which is the normal curve with mean μ and standard deviation σ. The lab reads μ from -10 to 10 and σ from 0.05 to 3.
- How do I find a quantile (inverse CDF) of the beta distribution?
- Enter a probability p from 0.000001 to 0.999999. The lab solves I_x(α, β) = p for x on the small side, so a quantile next to 1 keeps its digits: Beta(0.1, 0.1) at p = 0.99 prints as 1 - 8.86928e-18. It then puts x back through the CDF and shows the relative gap from p. A probability of exactly 0 or 1 is an end of the support, which the lab names rather than computes.
- Why does the simulated mean not match the model mean exactly?
- Draws carry sampling error. The lab shows the sample mean beside the model mean, the standard error (the sample standard deviation over the square root of the number of draws) and how many standard errors apart the two are, and the share of draws inside your interval beside the model probability. The same seed always gives the same draws, and New draws picks a fresh seed. With a lognormal and a large sigma the sample mean settles slowly, because a few very large draws dominate it.
- What is in the CSV download?
- One row per draw: the draw number, x, and for a beta 1 - x (kept separately, so a draw within about 1e-16 of 1 keeps its digits) or for a lognormal ln x. The file name records the parameters and the seed, and every cell below the header row is a plain number.
- What is a beta distribution used to model?
- It describes a continuous value between 0 and 1, such as a hypothetical proportion. Alpha and beta are positive shape parameters; neither is a measured probability. The lab explores supplied shapes; it does not estimate them from observations or predict a real outcome.
- How do beta and gamma distributions differ and relate?
- A Beta(α, β) variable is a continuous proportion on 0 to 1, with density x^(α - 1)(1 - x)^(β - 1)/B(α, β) for 0 < x < 1. A Gamma(k, r) variable has positive, unbounded support and density r^k x^(k - 1) exp(-rx)/Γ(k) for x > 0, using shape k > 0 and rate r > 0. Beta has two shape parameters; gamma has a shape and a rate or scale. For example, Beta(2, 5) has mean 2/7 and variance 5/196, whereas Gamma(2, rate 5) has mean 2/5 and variance 2/25. Their density at x = 0.5 is respectively 15/16 = 0.9375 and 12.5 exp(-2.5), about 1.026062; density can exceed 1. There is also a precise relationship: if U and V are independent gamma variables with shapes α and β and the same rate r, then Z = U/(U + V) is Beta(α, β). Set S = U + V: U = SZ and V = S(1 - Z), with Jacobian S. Their joint density separates into a Gamma(α + β, r) density for S and a Beta(α, β) density for Z. Thus independent Gamma(2, rate 5) and Gamma(5, rate 5) give a beta ratio with mean 2/7, not the ratio of arbitrary dependent gamma variables. The lab calculates beta and lognormal distributions; these gamma formulas are explanatory.
- What do alpha and beta mean in a gamma distribution?
- In the shape-rate convention Gamma(α, β), α > 0 is the shape and β > 0 is the rate: f(x) = β^α x^(α - 1) exp(-βx)/Γ(α), E[X] = α/β and Var(X) = α/β² for x > 0. Some texts instead use β for the scale, in which case f(x) = x^(α - 1) exp(-x/β)/(Γ(α)β^α), E[X] = αβ and Var(X) = αβ². The scale equals 1/rate, so the convention must be stated. With α = 2 and rate β = 5, the equivalent scale is 1/5 = 0.2, the mean is 0.4 and the variance is 0.08. Using scale β = 5 instead gives mean 10 and variance 50: it is a different distribution. In a beta distribution, β is a second shape, not a rate or scale; the beta controls do not perform gamma calculations.
- What is the three-point beta-PERT formula used in project management?
- Beta-PERT models a hypothetical activity duration T between supplied optimistic and pessimistic bounds a and b, with a supplied most likely value m and a < m < b. Assume these are model bounds, not observed guarantees. Write T = a + (b - a)Z, where Z follows Beta(α, β). For a general scaled beta, the four parameters are any positive shapes α and β and bounds a < b, with E[T] = a + (b - a)α/(α + β). For weighting λ = 4, set α = 1 + 4(m - a)/(b - a) and β = 1 + 4(b - m)/(b - a). These shapes make the mode of T equal m and give E[T] = (a + 4m + b)/6. Its density on a < t < b is the beta density at (t - a)/(b - a), divided by b - a; its exact variance is (b - a)²αβ/((α + β)²(α + β + 1)). For a = 2, m = 4 and b = 8 time units, α = 7/3, β = 11/3, support is 2 to 8, mode is 4, mean is 13/3 (about 4.333333) and variance is 11/9 (about 1.222222 square time units). The commonly taught PERT standard-deviation estimate (b - a)/6 gives 1 here, hence estimated variance 1; it is an approximation, not the exact variance of this beta-PERT parameterization. The distribution describes one assumed bounded duration, not project dependencies or a computed completion date. The lab accepts standard beta shapes on 0 to 1; it does not accept three-point duration inputs or calculate scaled durations.
- How does beta-PERT compare with a triangular distribution?
- Both can use bounds a < m < b and mode m, but they assume different density shapes. A triangular density is 2(t - a)/((b - a)(m - a)) from a to m, and 2(b - t)/((b - a)(b - m)) from m to b. Beta-PERT uses a beta density rescaled to a to b with α = 1 + 4(m - a)/(b - a) and β = 1 + 4(b - m)/(b - a). The triangular mean is (a + m + b)/3 and its variance is (a² + m² + b² - am - ab - mb)/18. With a = 2, m = 4 and b = 8, triangular mean is 14/3 and variance 14/9, compared with beta-PERT mean 13/3 and exact variance 11/9. Sharing three supplied values does not make the distributions identical; neither is fitted by this lab.
- What is a beta generalized linear mixed model (GLMM)?
- A beta GLMM describes continuous responses strictly between 0 and 1 using a conditional mean and precision. One specification is Y_ij given u_j follows Beta(μ_ij φ, (1 - μ_ij)φ), with φ > 0, logit(μ_ij) = ln(μ_ij/(1 - μ_ij)) = θ₀ + θ₁x_ij + u_j, and independent group random intercepts u_j following Normal(0, τ²). Conditional on the random effects, observations are assumed independent. The inverse link is μ_ij = 1/(1 + exp(-η_ij)); the conditional variance is μ_ij(1 - μ_ij)/(φ + 1). For supplied θ₀ = 0, θ₁ = ln 2, x = 1, u = 0 and φ = 6, η = ln 2, μ = 2/3 and the conditional distribution is Beta(4, 2), with variance 2/63 (about 0.031746). If the supplied u is ln 2 instead, μ = 4/5 and the shapes are 24/5 and 6/5, with variance 4/175 (about 0.022857). These are conditional examples, not estimated coefficients or random effects. Integrating out a shared u generally gives a mixture rather than a single beta distribution and induces within-group dependence. Values exactly 0 or 1 and Bernoulli counts require a different response model. The lab can inspect supplied beta shapes; it does not fit a GLMM or compute its marginal likelihood.
- How is maximum likelihood estimation derived for a beta distribution?
- For independent observations 0 < x_i < 1 and positive shapes α and β, multiplying the beta densities gives L = B(α, β)^(-n) ∏x_i^(α - 1)(1 - x_i)^(β - 1). Therefore ℓ = -n ln B(α, β) + (α - 1)Σln x_i + (β - 1)Σln(1 - x_i). Differentiating gives score equations n[ψ(α + β) - ψ(α)] + Σln x_i = 0 and n[ψ(α + β) - ψ(β)] + Σln(1 - x_i) = 0, where ψ is the derivative of ln Γ. There is generally no closed-form solution: solve both equations numerically while keeping α and β positive, or maximize ℓ in log α and log β, checking convergence and scores. For the example observations 0.25 and 0.75, both log sums are ln(3/16). Symmetry gives α = β = c, and ψ(2c) - ψ(c) = -ln(3/16)/2 gives c about 1.953895. The likelihood at this solution is about 1.266055, compared with 1 at α = β = 1 and 1.265625 at α = β = 2. For fixed n, the factorization also shows that the pair (Σln x_i, Σln(1 - x_i)) is sufficient for the shapes. Exact endpoint observations make these logarithms undefined, and identical observations can have no finite maximizer, so an estimator needs explicit input and convergence rules. This is a worked likelihood explanation; the lab does not estimate shapes from uploaded or entered observations.
- How is the beta-binomial distribution related to beta?
- A beta-binomial model draws a probability p from Beta(α, β), then counts successes in n independent Bernoulli trials conditional on p. Its probability mass at k successes is C(n,k) B(k + α, n - k + β) / B(α, β), for k = 0, ..., n; C(n,k) is the binomial coefficient, or n choose k. For n = 2 and α = β = 1, counts 0, 1 and 2 each have probability 1/3. With n = 1 this is the beta-Bernoulli model. This lab plots the continuous beta density; it does not calculate a discrete beta-binomial PMF for your n.
- How does a beta prior become a posterior?
- In a Bernoulli model with a Beta(α, β) prior, s successes and f failures give a Beta(α + s, β + f) posterior. For a Beta(1, 1) prior, one success and one failure give Beta(2, 2), with mean 1/2 and variance 1/20. Enter the updated shapes to inspect that distribution; the lab does not collect observations or perform the update automatically.
- How is the beta CDF computed?
- The CDF of a beta distribution is the regularized incomplete beta function I_x(α, β). The lab evaluates it with a continued fraction (the Lentz method) on whichever side of (α + 1)/(α + β + 2) it converges faster, and takes the other tail from that one, carrying both as logarithms so a tail far below the smallest double, such as 4.52698e-542 for Beta(100, 100) below 0.000001, still prints. The fraction stops after 2,000 terms and reports a failure rather than show a half-converged value; across α and β from 0.1 to 100 it converges in a few dozen terms, at most 58 in the cases tested.
The parameters describe a mathematical model, not a fit to data or a prediction about real events, and in lognormal mode μ and σ are the mean and standard deviation of log(X), not of X. Probabilities, quantiles and moments are computed numerically, the incomplete beta by a continued fraction, and printed to six decimal places (six significant figures in e-notation below 0.0001 or from a billion up), with each quantile's round trip through the CDF shown; simulated summaries carry sampling error, shown as a standard error, and the same seed gives the same draws. A beta density that is infinite at 0 or 1 is labelled at that end rather than drawn as a finite peak.