This is an old version, view current version.

12.1 Bernoulli Distribution

12.1.1 Probability Mass Function

If θ[0,1], then for y{0,1}, Bernoulli(y | θ)={θif y=1, and1θif y=0.

12.1.2 Sampling Statement

y ~ bernoulli(theta)

Increment target log probability density with bernoulli_lpmf(y | theta) dropping constant additive terms.

12.1.3 Stan Functions

real bernoulli_lpmf(ints y | reals theta)
The log Bernoulli probability mass of y given chance of success theta

real bernoulli_cdf(ints y, reals theta)
The Bernoulli cumulative distribution function of y given chance of success theta

real bernoulli_lcdf(ints y | reals theta)
The log of the Bernoulli cumulative distribution function of y given chance of success theta

real bernoulli_lccdf(ints y | reals theta)
The log of the Bernoulli complementary cumulative distribution function of y given chance of success theta

R bernoulli_rng(reals theta)
Generate a Bernoulli variate with chance of success theta; may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section vectorized PRNG functions.