#### Previous topic

scipy.special.gdtrix

#### Next topic

scipy.special.nbdtrc

# scipy.special.nbdtr

`scipy.special.``nbdtr`(k, n, p) = <ufunc 'nbdtr'>

  Negative binomial cumulative distribution function.

  Returns the sum of the terms 0 through k of the negative binomial distribution probability mass function,

  \[F = \sum_{j=0}^k {{n + j - 1}\choose{j}} p^n (1 - p)^j.\]

  In a sequence of Bernoulli trials with individual success probabilities p, this is the probability that k or fewer failures precede the nth success.

  Parameters:

  k : array_like

  > The maximum number of allowed failures (nonnegative int).

  n : array_like

  > The target number of successes (positive int).

  p : array_like

  > Probability of success in a single event (float).

  Returns:

  F : ndarray

  > The probability of k or fewer failures before n successes in a sequence of events with individual success probability p.

  See also

  `nbdtrc`

  Notes

  If floating point values are passed for k or n, they will be truncated to integers.

  The terms are not summed directly; instead the regularized incomplete beta function is employed, according to the formula,

  \[\mathrm{nbdtr}(k, n, p) = I_{p}(n, k + 1).\]

  Wrapper for the Cephes [R467] routine `nbdtr`.

  References

  [R467] | (1, 2) Cephes Mathematical Functions Library, http://www.netlib.org/cephes/index.html