This is an old version, view current version.

17.3 Negative binomial distribution (log alternative parameterization)

Related to the parameterization in section negative binomial, alternative parameterization, the following parameterization uses a log mean parameter η=log(μ), defined for ηR, ϕR+, so that for nN, NegBinomial2Log(n|η,ϕ)=NegBinomial2(n|exp(η),ϕ). This alternative may be used for sampling, as a function, and for random number generation, but as of yet, there are no CDFs implemented for it. This is especially useful for log-linear negative binomial regressions.

17.3.1 Sampling statement

n ~ neg_binomial_2_log(eta, phi)

Increment target log probability density with neg_binomial_2_log_lupmf(n | eta, phi).
Available since 2.3

17.3.2 Stan functions

real neg_binomial_2_log_lpmf(ints n | reals eta, reals phi)
The log negative binomial probability mass of n given log-location eta and inverse overdispersion parameter phi.
Available since 2.20

real neg_binomial_2_log_lupmf(ints n | reals eta, reals phi)
The log negative binomial probability mass of n given log-location eta and inverse overdispersion parameter phi dropping constant additive terms.
Available since 2.25

R neg_binomial_2_log_rng(reals eta, reals phi)
Generate a negative binomial variate with log-location eta and inverse overdispersion control phi; may only be used in transformed data and generated quantities blocks. eta must be less than 29log2. For a description of argument and return types, see section vectorized function signatures.
Available since 2.18