Beta Distribution
Overview
The beta distriubtion is a family of probability distributions over the interval [0,1], parameterized by two variables,
{% \alpha %},{% \beta %}.
{% f(x) = x^{\alpha-1}(1-x)^{\beta-1} / B(\alpha, \beta) %}
{% B(\alpha, \beta) = \Gamma(\alpha) \Gamma(\beta) / \Gamma(\alpha + \beta) %}
Moments
The mean of the Beta distribution in terms of the shape parameters is
{% \mu = \frac{\alpha}{\alpha+\beta} %}
The variance is given by
{% \sigma ^2 = \alpha \beta / [(\alpha+\beta)^2(\alpha+\beta+1)] %}
Likewise, the shape parameters can be computed from the moments.
{% \alpha = (\frac{1-\mu}{\sigma^2} - \frac{1}{\mu}) \mu ^2 %}
{% \beta = \alpha(\frac{1}{\mu} - 1) %}
API
The
beta library
provides methods for calculating a beta distributions moments as well as methods to simulate the distribution.