scipy.special.ndtri#

scipy.special.ndtri(y, out=None) = <ufunc 'ndtri'>#

Inverse of ndtr vs x

Returns the argument x for which the area under the standard normal probability density function (integrated from minus infinity to x) is equal to y.

Parameters:
parray_like

Probability

outndarray, optional

Optional output array for the function results

Returns:
xscalar or ndarray

Value of x such that ndtr(x) == p.

See also

ndtr

Standard normal cumulative probability distribution

ndtri_exp

Inverse of log_ndtr

Examples

ndtri is the percentile function of the standard normal distribution. This means it returns the inverse of the cumulative density ndtr. First, let us compute a cumulative density 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 function. For that purpose, we provide a NumPy array as argument.

>>> import matplotlib.pyplot as plt
>>> x = np.linspace(0.01, 1, 200)
>>> fig, ax = plt.subplots()
>>> ax.plot(x, ndtri(x))
>>> ax.set_title("Standard normal percentile function")
>>> plt.show()
../../_images/scipy-special-ndtri-1.png