This is an old version, view current version.

19.1 Beta Distribution

19.1.1 Probability Density Function

If αR+ and βR+, then for θ(0,1), Beta(θ|α,β)=1B(α,β)θα1(1θ)β1, where the beta function B() is as defined in section combinatorial functions.

Warning: If θ=0 or θ=1, then the probability is 0 and the log probability is . Similarly, the distribution requires strictly positive parameters, α,β>0.

19.1.2 Sampling Statement

theta ~ beta(alpha, beta)

Increment target log probability density with beta_lpdf( theta | alpha, beta) dropping constant additive terms.

19.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

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

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

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

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 generated quantities block. For a description of argument and return types, see section vectorized PRNG functions.