20.1 Beta distribution
20.1.1 Probability density function
If \(\alpha \in \mathbb{R}^+\) and \(\beta \in \mathbb{R}^+\), then for \(\theta \in (0,1)\), \[ \text{Beta}(\theta|\alpha,\beta) = \frac{1}{\mathrm{B}(\alpha,\beta)} \, \theta^{\alpha - 1} \, (1 - \theta)^{\beta - 1} , \] where the beta function \(\mathrm{B}()\) is as defined in section combinatorial functions.
Warning: If \(\theta = 0\) or \(\theta = 1\), then the probability is 0 and the log probability is \(-\infty\). Similarly, the distribution requires strictly positive parameters, \(\alpha, \beta > 0\).
20.1.2 Sampling statement
theta ~ beta(alpha, beta)
Increment target log probability density with beta_lupdf(theta | alpha, beta).
Available since 2.0
20.1.3 Stan functions
real beta_lpdf(reals theta | reals alpha, reals beta)
The log of the beta density of theta in \([0,1]\) given positive prior
successes (plus one) alpha and prior failures (plus one) beta
Available since 2.12
real beta_lupdf(reals theta | reals alpha, reals beta)
The log of the beta density of theta in \([0,1]\) given positive prior
successes (plus one) alpha and prior failures (plus one) beta
dropping constant additive terms
Available since 2.25
real beta_cdf(reals theta, reals alpha, reals beta)
The beta cumulative distribution function of theta in \([0,1]\) given
positive prior successes (plus one) alpha and prior failures (plus
one) beta
Available since 2.0
real beta_lcdf(reals theta | reals alpha, reals beta)
The log of the beta cumulative distribution function of theta in
\([0,1]\) given positive prior successes (plus one) alpha and prior
failures (plus one) beta
Available since 2.12
real beta_lccdf(reals theta | reals alpha, reals beta)
The log of the beta complementary cumulative distribution function of
theta in \([0,1]\) given positive prior successes (plus one) alpha and
prior failures (plus one) beta
Available since 2.12
R beta_rng(reals alpha, reals beta)
Generate a beta variate with positive prior successes (plus one) alpha
and prior failures (plus one) beta; may only be used in transformed data and
generated quantities blocks. For a description of argument and return types, see
section vectorized PRNG functions.
Available since 2.18