Inverse standard normal CDF (probit / quantile function).
Computes , the quantile function of the standard normal distribution. This is the workhorse for sampling Gaussian variates from uniforms via inverse-CDF, for probit regression, and for converting tail probabilities back to standard scores.
Parameters
inputTensorReturns
Tensor element-wise, same shape and dtype as
input; values are unbounded reals.
Notes
The implementation uses the Beasley-Springer-Moro rational approximation. The unit interval is split into a central region with , , in which a rational polynomial in is evaluated, and two symmetric tail regions in which a rational polynomial in is used:
The approximation is accurate to roughly
over its supported domain, which is as much as float32 holds. A
float64 input gets one Newton step on top of it, taken where each
stretch keeps its relative precision (on in the
centre, on in the tails), and is then
accurate to the last few digits across to
. Boundary behaviour:
, and the function blows up to
at the endpoints.
Examples
>>> import lucid
>>> from lucid.special import ndtri
>>> ndtri(lucid.tensor([0.025, 0.5, 0.975]))
tensor([-1.96, 0., 1.96])