Beta Distribution¶
Formula¶
\[
f(x)=\frac{x^{\alpha-1}(1-x)^{\beta-1}}{B(\alpha,\beta)},\quad 0\le x \le 1
\]
Plot¶
fn: 6*x*(1-x)
xmin: 0
xmax: 1
ymin: 0
ymax: 1.7
height: 280
title: Beta PDF (alpha=2, beta=2)
Parameters¶
- \(\alpha,\beta>0\): shape parameters
- \(B(\alpha,\beta)\): beta function
What it means¶
A flexible distribution on \([0,1]\), often used to model probabilities.
What it's used for¶
- Bayesian priors/posteriors for Bernoulli/binomial probabilities.
- Modeling proportions.
Key properties¶
- Shape can be uniform, U-shaped, unimodal, etc.
- Mean \( \alpha/(\alpha+\beta)\).
Common gotchas¶
- Different shapes can have the same mean.
- Parameters are not directly mean/variance unless reparameterized.
Example¶
\(\mathrm{Beta}(1,1)\) is the uniform distribution on \([0,1]\).
How to Compute (Pseudocode)¶
Input: distribution parameters and query values (for PMF/PDF/CDF or moments)
Output: distribution quantities
validate parameters
for each query value x (or count k):
evaluate the PMF/PDF/CDF formula from the card
optionally compute moments/statistics from known closed forms or by summation/integration
return the requested values
Complexity¶
- Time: Typically \(O(q)\) for \(q\) query values once parameters are known (assuming constant-time formula evaluation per query)
- Space: \(O(q)\) for output values (or \(O(1)\) for a single query)
- Assumptions: Parameter estimation/fitting cost is excluded; numerical special-function evaluation can affect constants for some families