inverse_normal_distribution()

audmath.inverse_normal_distribution(y)[source]

Inverse normal distribution.

Returns the argument xx for which the area under the Gaussian probability density function is equal to yy. It returns nan\text{nan} if y[0,1]y \notin [0, 1].

The area under the Gaussian probability density function is given by:

12πxexp(t2/2)dt\frac{1}{\sqrt{2\pi}} \int_{-\infty}^x \exp(-t^2 / 2)\,\text{d}t

This function is a numpy port of the Cephes C code. Douglas Thor implemented it in pure Python under GPL-3.

The output is identical to the implementation provided by scipy.special.ndtri(), and scipy.stats.norm.ppf(), and allows you to avoid installing and importing scipy. audmath.inverse_normal_distribution() is slower for large arrays as the following comparison of execution times on a standard PC show.

Samples

scipy

audmath

10.000

0.00s

0.01s

100.000

0.00s

0.09s

1.000.000

0.02s

0.88s

10.000.000

0.25s

9.30s

Parameters

y (Union[int, float, Sequence, ndarray]) – input value

Return type

Union[floating, ndarray]

Returns

inverted input

Examples

>>> inverse_normal_distribution([0.05, 0.4, 0.6, 0.95])
array([-1.64485363, -0.2533471 , 0.2533471 , 1.64485363])