Skip to content

Negative Binomial (Pascal) #47

@LeonidElkin

Description

@LeonidElkin

Family: Negative Binomial (Pascal)

Naming: NegativeBinomial (negative binomial distribution in the “number of failures before r-th success” parametrization).

Task

Implement the negative binomial family as a ParametricFamily, add all parameterizations and analytical characteristics, and register the family in the registry.

Base parameterization

  • Base parameters: (r, p):
    • r > 0 (shape / number of successes, not necessarily integer if using the general form),
    • 0 < p < 1 (success probability).

Interpretation: X is the number of failures before the r-th success.

Support: k in {0, 1, 2, …}.

Other parameterizations and relations

  1. Shape–mean (r, μ):
    • Parameters: r > 0, μ > 0 (mean).
    • Relations to base:
      • μ = r * (1 - p) / p
      • p = r / (r + μ).

All characteristics should be defined in terms of (r, p).

Analytical characteristics (in terms of r, p)

For integer k >= 0:

  • pmf(k):

    • General (Gamma–function) form:
      pmf(k) = Γ(k + r) / (Γ(r) * k!) * (1 - p)^k * p^r.
      If r is integer, this is C(k + r - 1, k) * (1 - p)^k * p^r.
  • cdf(k):

    • cdf(k) = sum_{j=0}^k pmf(j).
      It can also be expressed via the regularized incomplete beta function.
  • ppf(u) for 0 < u < 1:

    • ppf(u) is the smallest integer k >= 0 such that cdf(k) >= u.
  • cf(t):

    • cf(t) = (p / (1 - (1 - p) * exp(i * t)))^r.
  • mean:

    • mean = r * (1 - p) / p.
  • var:

    • var = r * (1 - p) / p^2.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions