11.2 Bernoulli Distribution, Logit Parameterization
Stan also supplies a direct parameterization in terms of a logit-transformed chance-of-success parameter. This parameterization is more numerically stable if the chance-of-success parameter is on the logit scale, as with the linear predictor in a logistic regression.
11.2.1 Probability Mass Function
If \(\alpha \in \mathbb{R}\), then for \(y \in \{0,1\}\), \[ \text{BernoulliLogit}(y~|~\alpha) = \text{Bernoulli}(y | \text{logit}^{-1}(\alpha)) = \left\{ \begin{array}{ll} \text{logit}^{-1}(\alpha) & \text{if } y = 1, \text{ and} \\ 1 - \text{logit}^{-1}(\alpha) & \text{if } y = 0. \end{array} \right. \]
11.2.2 Sampling Statement
y ~
bernoulli_logit
(alpha)
Increment target log probability density with bernoulli_logit_lpmf( y | alpha)
dropping constant additive terms.
11.2.3 Stan Functions
real
bernoulli_logit_lpmf
(ints y | reals alpha)
The log Bernoulli probability mass of y given chance of success
inv_logit(alpha)
R
bernoulli_logit_rng
(reals alpha)
Generate a Bernoulli variate with chance of success
\(\text{logit}^{-1}(\alpha)\); may only be used in generated quantities
block. For a description of argument and return types, see section
vectorized PRNG functions.