13.3 Negative Binomial Distribution (log alternative parameterization)

Related to the parameterization in section 13.2, the following parameterization uses a log mean parameter \(\eta = \log(\mu)\), defined for \(\eta \in \mathbb{R}\), \(\phi \in \mathbb{R}^+\), so that for \(y \in \mathbb{N}\), \[ \text{NegBinomial2Log}(y \, | \, \eta, \phi) = \text{NegBinomial2}(y | \exp(\eta), \phi). \] 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 \(29 \log 2\). For a description of argument and return types, see section 10.8.1.