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)}\]

where \(B\) is the Beta function.

For more information, see

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



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


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


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

Beta distribution can be parameterized either in terms of alpha and beta, mean and standard deviation or mean and sample size. The link between the three 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\\\alpha = \mu * \nu \beta = (1 - \mu) * \nu\end{aligned}\end{align} \]
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 (0 < sigma < sqrt(mu * (1 - mu))).

nutensor_like of float, optional

Alternative “sample size” of a Beta distribution (nu > 0).


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


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

Creates a tensor variable corresponding to the cls distribution.