scipy.special.pdtri#
- scipy.special.pdtri(k, y, out=None) = <ufunc 'pdtri'>#
Inverse of
pdtrwith respect to m.Returns the Poisson variable m such that the sum from 0 to k of the Poisson density is equal to the given probability y: calculated by
gammainccinv(k + 1, y). k must be a nonnegative integer and y between 0 and 1.- Parameters:
- karray_like
Number of occurrences (nonnegative, real).
- yarray_like
Probability.
- outndarray, optional
Optional output array for the function results.
- Returns:
- scalar or ndarray
Values of the shape parameter m such that
pdtr(k, m) = y.
See also
Notes
Array API Standard Support
pdtrihas support for Python Array API Standard compatible backends in addition to NumPy. The following combinations of backend and device (or other capability) are supported.Library
CPU
GPU
NumPy
✅
n/a
CuPy
n/a
✅
PyTorch
✅
⛔
JAX
✅
⛔
Dask
✅
n/a
For the NumPy backend, this function supports all NumPy ufunc keyword arguments. Other backends may support
out, but none of the other ufunc kwargs.outis typically supported for CuPy and PyTorch, but not currently in cases where SciPy relies on a generic Array API implementation or, for PyTorch on CPU, falls back to the NumPy backend.outis never supported for JAX because JAX arrays are immutable.pdtridoes not currently supportoutfor the PyTorch backend.See Support for the array API standard for more information.
Examples
>>> import scipy.special as sc
Compute the CDF for several values of m:
>>> k = 1 >>> m = [0.5, 1, 1.5] >>> p = sc.pdtr(k, m) >>> p array([0.90979599, 0.73575888, 0.5578254 ])
Invert the CDF with respect to the Poisson mean. We recover the values of m, as expected:
>>> sc.pdtri(k, p) array([0.5, 1. , 1.5])
Verify the relation with
gammainccinv:>>> sc.gammainccinv(k + 1, p) array([0.5, 1. , 1.5])