15.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.
15.2.1 Probability mass function
If α∈R, then for y∈{0,1}, BernoulliLogit(y | α)=Bernoulli(y|logit−1(α))={logit−1(α)if y=1, and1−logit−1(α)if y=0.
15.2.2 Sampling statement
y ~
bernoulli_logit
(alpha)
Increment target log probability density with bernoulli_logit_lupmf(y | alpha)
.
Available since 2.0
15.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)
Available since 2.12
real
bernoulli_logit_lupmf
(ints y | reals alpha)
The log Bernoulli probability mass of y given chance of success
inv_logit(alpha)
dropping constant additive terms
Available since 2.25
R
bernoulli_logit_rng
(reals alpha)
Generate a Bernoulli variate with chance of success
logit−1(α); may only be used in transformed data and generated
quantities blocks. For a description of argument and return types, see section
vectorized PRNG functions.
Available since 2.18