This is an old version, view current version.

13.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 yN, NegBinomial2Log(y|η,ϕ)=NegBinomial2(y|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.

13.3.1 Sampling Statement

y ~ neg_binomial_2_log(eta, phi)

Increment target log probability density with neg_binomial_2_log_lpmf( y | eta, phi) dropping constant additive terms.

13.3.2 Stan Functions

real neg_binomial_2_log_lpmf(ints y | reals eta, reals phi)
The log negative binomial probability mass of n given log-location eta and inverse overdispersion control phi. This is especially useful for log-linear negative binomial regressions.

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 generated quantities block. eta must be less than 29log2. For a description of argument and return types, see section vectorized function signatures.