pymc.Beta#

class pymc.Beta(name, *args, rng=None, dims=None, initval=None, observed=None, total_size=None, transform=UNSET, **kwargs)[source]#

Beta log-likelihood.

The pdf of this distribution is

\[f(x \mid \alpha, \beta) = \frac{x^{\alpha - 1} (1 - x)^{\beta - 1}}{B(\alpha, \beta)}\]

(Source code, png, hires.png, pdf)

../../../_images/pymc-Beta-1.png

Support

\(x \in (0, 1)\)

Mean

\(\dfrac{\alpha}{\alpha + \beta}\)

Variance

\(\dfrac{\alpha \beta}{(\alpha+\beta)^2(\alpha+\beta+1)}\)

Beta distribution can be parameterized either in terms of alpha and beta or mean and standard deviation. The link between the two parametrizations is given by

\[ \begin{align}\begin{aligned}\begin{split}\alpha &= \mu \kappa \\ \beta &= (1 - \mu) \kappa\end{split}\\\text{where } \kappa = \frac{\mu(1-\mu)}{\sigma^2} - 1\end{aligned}\end{align} \]
Parameters
alphatensor_like of float, optional

alpha > 0. If not specified, then calculated using mu and sigma.

betatensor_like of float, optional

beta > 0. If not specified, then calculated using mu and sigma.

mutensor_like of float, optional

Alternative mean (0 < mu < 1).

sigmatensor_like of float, optional

Alternative standard deviation (1 < sigma < sqrt(mu * (1 - mu))).

Notes

Beta distribution is a conjugate prior for the parameter \(p\) of the binomial distribution.

Methods

Beta.__init__(*args, **kwargs)

Beta.dist([alpha, beta, mu, sigma])

Creates a tensor variable corresponding to the cls distribution.

Beta.get_alpha_beta([alpha, beta, mu, sigma])

Beta.logcdf(alpha, beta)

Compute the log of the cumulative distribution function for Beta distribution at the specified value.

Beta.moment(size, alpha, beta)

Attributes

rv_class

rv_op