This is an old version, view current version.

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

12.2.1 Probability Mass Function

If αR, then for y{0,1}, BernoulliLogit(y | α)=Bernoulli(y|logit1(α))={logit1(α)if y=1, and1logit1(α)if y=0.

12.2.2 Sampling Statement

y ~ bernoulli_logit(alpha)

Increment target log probability density with bernoulli_logit_lpmf(y | alpha) dropping constant additive terms.

12.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 logit1(α); may only be used in transformed data and generated quantities blocks. For a description of argument and return types, see section vectorized PRNG functions.