Vous êtes un professionnel et vous avez besoin d'une formation ?
Programmation Python
Les fondamentaux
Voir le programme détaillé
Module « scipy.special »
Signature de la fonction nbdtrin
def nbdtrin(*args, **kwargs)
Description
help(scipy.special.nbdtrin)
nbdtrin(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature])
nbdtrin(k, y, p, out=None)
Inverse of `nbdtr` vs `n`.
Returns the inverse with respect to the parameter `n` of
``y = nbdtr(k, n, p)``, the negative binomial cumulative distribution
function.
Parameters
----------
k : array_like
The maximum number of allowed failures (nonnegative int).
y : array_like
The probability of `k` or fewer failures before `n` successes (float).
p : array_like
Probability of success in a single event (float).
out : ndarray, optional
Optional output array for the function results
Returns
-------
n : scalar or ndarray
The number of successes `n` 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)`.
nbdtrik : Inverse with respect to `k` of `nbdtr(k, n, p)`.
Notes
-----
Wrapper for the CDFLIB [1]_ Fortran routine `cdfnbn`.
Formula 26.5.26 of [2]_,
.. math::
\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 :math:`I`.
Computation of `n` involves a search for a value that produces the desired
value of `y`. The search relies on the monotonicity of `y` with `n`.
References
----------
.. [1] Barry Brown, James Lovato, and Kathy Russell,
CDFLIB: Library of Fortran Routines for Cumulative Distribution
Functions, Inverses, and Other Parameters.
.. [2] Milton Abramowitz and Irene A. Stegun, eds.
Handbook of Mathematical Functions with Formulas,
Graphs, and Mathematical Tables. New York: Dover, 1972.
Examples
--------
Compute the negative binomial cumulative distribution function for an
exemplary parameter set.
>>> from scipy.special import nbdtr, nbdtrin
>>> k, n, p = 5, 2, 0.5
>>> cdf_value = nbdtr(k, n, p)
>>> cdf_value
0.9375
Verify that `nbdtrin` recovers the original value for `n` up to floating
point accuracy.
>>> nbdtrin(k, cdf_value, p)
1.999999999998137
Vous êtes un professionnel et vous avez besoin d'une formation ?
Calcul scientifique
avec Python
Voir le programme détaillé
Améliorations / Corrections
Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.
Emplacement :
Description des améliorations :