pypomp.random.nbinomial_logw¶
- pypomp.random.nbinomial_logw(x: Array, n: Array | float, p: Array | float | None = None, mu: Array | float | None = None) Array[source]¶
DPOP log-weight of a negative binomial draw, such as from
fast_nbinomial().- Parameters:
x (jax.Array) – The number of failures before
nsuccesses.n (jax.Array or float) – The size parameter. Unlike the binomial’s number of trials, it is not held fixed, so its gradient is included.
p (jax.Array, float or None, optional) – The success probability. Mutually exclusive with
mu.mu (jax.Array, float or None, optional) – The mean,
n * (1 - p) / p. Mutually exclusive withp.
- Returns:
lgamma(x + n) - lgamma(n) + n * log(p) + x * log(1 - p), withp = n / (n + mu)whenmuis given andxheld fixed.- Return type: