12.1 Bernoulli Distribution
12.1.1 Probability Mass Function
If \(\theta \in [0,1]\), then for \(y \in \{0,1\}\), \[ \text{Bernoulli}(y~|~\theta) = \left\{ \begin{array}{ll} \theta & \text{if } y = 1, \text{ and} \\ 1 - \theta & \text{if } y = 0. \end{array} \right. \]
12.1.2 Sampling Statement
y ~
bernoulli
(theta)
Increment target log probability density with bernoulli_lupmf(y | theta)
.
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_lupmf
(ints y | reals theta)
The log Bernoulli probability mass of y given chance of success theta
dropping constant additive terms
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.