scipy.special.ndtri
- scipy.special.ndtri(p, out=None) = <ufunc 'ndtri'>
Inverse of
ndtr.Returns the quantile x such that the cumulative distribution function of the standard normal distribution evaluated at x equals p, that is,
ndtr(x) == p.
Inverse of ndtr.
Returns the quantile x such that the cumulative distribution function of the
standard normal distribution evaluated at x equals p, that is, ndtr(x) == p.
Probability values.
Optional output array for the function results.
Quantile(s) corresponding to the probabilitie(s) in p.
Array API Standard Support
ndtri has experimental support for Python Array API Standard compatible
backends in addition to NumPy. Please consider testing these features
by setting an environment variable SCIPY_ARRAY_API=1 and providing
CuPy, PyTorch, JAX, or Dask arrays as array arguments. 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 |
See Support for the array API standard for more information.
ndtri is the percentile (quantile) function of the standard normal distribution,
i.e., the inverse of the cumulative distribution function ndtr.
First, compute a cumulative distribution value:
>>> import numpy as np
>>> from scipy.special import ndtri, ndtr
>>> cdf_val = ndtr(2)
>>> cdf_val
0.9772498680518208
Verify that ndtri yields the original value for x up to floating point errors.
>>> ndtri(cdf_val)
2.0000000000000004
Plot the percentile function over a range of probabilities.
>>> import matplotlib.pyplot as plt
>>> p = np.linspace(1e-3, 1 - 1e-3, 201)
>>> fig, ax = plt.subplots()
>>> ax.