14.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 \(\eta = \log(\mu)\), defined for \(\eta \in \mathbb{R}\), \(\phi \in \mathbb{R}^+\), so that for \(n \in \mathbb{N}\), \[ \text{NegBinomial2Log}(n \, | \, \eta, \phi) = \text{NegBinomial2}(n | \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. This is especially useful for log-linear negative binomial regressions.
14.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)
.
14.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
.
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.
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 \(29 \log 2\). For a description of
argument and return types, see section vectorized function signatures.