Skip to main content

normal_quantile

Function normal_quantile 

Source
pub fn normal_quantile(p: f64) -> f64
Expand description

The standard normal quantile z with P(Z <= z) = p, the inverse of the normal CDF.

Wichura’s algorithm AS241 PPND16 (Applied Statistics 37, 1988): rational approximations accurate to about 1e-16 relative over (0, 1). Returns -inf at p = 0, +inf at p = 1 and NaN outside [0, 1].

§Examples

use backshift::normal_quantile;

assert!((normal_quantile(0.975) - 1.959963984540054).abs() < 1e-14);
assert_eq!(normal_quantile(0.5), 0.0);