SciPy

scipy.special.nbdtrik

scipy.special.nbdtrik(y, n, p) = <ufunc 'nbdtrik'>

Inverse of nbdtr vs k.

Returns the inverse with respect to the parameter k of y = nbdtr(k, n, p), the negative binomial cumulative distribution function.

Parameters:

y : array_like

The probability of k or fewer failures before n successes (float).

n : array_like

The target number of successes (positive int).

p : array_like

Probability of success in a single event (float).

Returns:

k : ndarray

The maximum number of allowed failures such that nbdtr(k, n, p) = y.

See also

nbdtr
Cumulative distribution function of the negative binomial.
nbdtri
Inverse with respect to p of nbdtr(k, n, p).
nbdtrin
Inverse with respect to n of nbdtr(k, n, p).

Notes

Wrapper for the CDFLIB [R497] Fortran routine cdfnbn.

Formula 26.5.26 of [R498],

\[\sum_{j=k + 1}^\infty {{n + j - 1}\choose{j}} p^n (1 - p)^j = I_{1 - p}(k + 1, n),\]

is used to reduce calculation of the cumulative distribution function to that of a regularized incomplete beta \(I\).

Computation of k involves a seach for a value that produces the desired value of y. The search relies on the monotinicity of y with k.

References

[R497](1, 2) Barry Brown, James Lovato, and Kathy Russell, CDFLIB: Library of Fortran Routines for Cumulative Distribution Functions, Inverses, and Other Parameters.
[R498](1, 2) Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

Previous topic

scipy.special.nbdtri

Next topic

scipy.special.nbdtrin