Kolmogorov Smirnov Dist
A port to Kotlin of the Java implementation provided in:
Simard R, L’Ecuyer P. Computing the Two-Sided Kolmogorov-Smirnov Distribution. J Stat Soft. 2011.; 39(11). Available from: http://www.jstatsoft.org/v39/i11/
Computes both the cumulative probability PD_n <= x and the complementary cumulative probability PD_n >= x of the 2-sided 1-sample Kolmogorov-Smirnov distribution.
The Kolmogorov-Smirnov test statistic D_n is defined by
D_n = sup_x |F(x) - S_n(x)|
where n is the sample size, S_n(x) is an empirical distribution function, and F(x) is a completely specified theoretical distribution.
Functions
Computes the cumulative probability PD_n <= x of the Kolmogorov-Smirnov distribution with sample size n at x. It returns at least 13 decimal digits of precision for n <= 140, at least 5 decimal digits of precision for 140 < n <= 100000, and a few correct decimal digits for n 100000.
Computes the complementary cumulative probability PD_n >= x of the Kolmogorov-Smirnov distribution with sample size n at x. It returns at least 10 decimal digits of precision for n <= 140, at least 5 decimal digits of precision for 140 < n <= 200000, and a few correct decimal digits for n 200000.