pub fn ks_test_normal(data: &[f64]) -> Option<(f64, f64)>Expand description
Kolmogorov-Smirnov one-sample test against the standard normal distribution.
§Algorithm
D = max|F_n(x) - Φ(x)| where F_n is the ECDF and Φ is the CDF of N(0,1). P-value approximation: Kolmogorov distribution (Marsaglia et al., 2003).
§Returns
None if fewer than 5 observations or non-finite values.
§Examples
use u_analytics::distribution::ks_test_normal;
// Data from approximately N(0,1)
let data = [-1.2, -0.8, -0.3, 0.1, 0.5, 0.7, 1.1, 1.4];
let (d_stat, p_value) = ks_test_normal(&data).unwrap();
assert!(p_value > 0.05); // cannot reject normality