Class KolmogorovSmirnovDistribution
java.lang.Object
org.apache.commons.math3.distribution.KolmogorovSmirnovDistribution
- All Implemented Interfaces:
Serializable
Deprecated.
Implementation of the Kolmogorov-Smirnov distribution.
Treats the distribution of the two-sided P(D_n < d) where
D_n = sup_x |G(x) - G_n (x)| for the theoretical cdf G and
the empirical cdf G_n.
This implementation is based on [1] with certain quick decisions for extreme values given in [2].
In short, when wanting to evaluate P(D_n < d), the method in [1] is
to write d = (k - h) / n for positive integer k and
0 <= h < 1. Then P(D_n < d) = (n! / n^n) * t_kk, where
t_kk is the (k, k)'th entry in the special matrix
H^n, i.e. H to the n'th power.
References:
- [1] Evaluating Kolmogorov's Distribution by George Marsaglia, Wai Wan Tsang, and Jingbo Wang
- [2] Computing the Two-Sided Kolmogorov-Smirnov Distribution by Richard Simard and Pierre L'Ecuyer
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublecdf(double d) Deprecated.CalculatesP(D_n < d)using method described in [1] with quick decisions for extreme values given in [2] (see above).doublecdf(double d, boolean exact) Deprecated.CalculatesP(D_n < d)using method described in [1] with quick decisions for extreme values given in [2] (see above).doublecdfExact(double d) Deprecated.CalculatesP(D_n < d)using method described in [1] with quick decisions for extreme values given in [2] (see above).
-
Constructor Details
-
KolmogorovSmirnovDistribution
Deprecated.- Parameters:
n- Number of observations- Throws:
NotStrictlyPositiveException- ifn <= 0
-
-
Method Details
-
cdf
Deprecated.CalculatesP(D_n < d)using method described in [1] with quick decisions for extreme values given in [2] (see above). The result is not exact as withcdfExact(double)because calculations are based ondoublerather thanBigFraction.- Parameters:
d- statistic- Returns:
- the two-sided probability of
P(D_n < d) - Throws:
MathArithmeticException- if algorithm fails to converthto aBigFractionin expressingdas(k - h) / mfor integerk, mand0 <= h < 1.
-
cdfExact
Deprecated.CalculatesP(D_n < d)using method described in [1] with quick decisions for extreme values given in [2] (see above). The result is exact in the sense that BigFraction/BigReal is used everywhere at the expense of very slow execution time. Almost never choose this in real applications unless you are very sure; this is almost solely for verification purposes. Normally, you would choosecdf(double)- Parameters:
d- statistic- Returns:
- the two-sided probability of
P(D_n < d) - Throws:
MathArithmeticException- if algorithm fails to converthto aBigFractionin expressingdas(k - h) / mfor integerk, mand0 <= h < 1.
-
cdf
Deprecated.CalculatesP(D_n < d)using method described in [1] with quick decisions for extreme values given in [2] (see above).- Parameters:
d- statisticexact- whether the probability should be calculated exact usingBigFractioneverywhere at the expense of very slow execution time, or ifdoubleshould be used convenient places to gain speed. Almost never choosetruein real applications unless you are very sure;trueis almost solely for verification purposes.- Returns:
- the two-sided probability of
P(D_n < d) - Throws:
MathArithmeticException- if algorithm fails to converthto aBigFractionin expressingdas(k - h) / mfor integerk, mand0 <= h < 1.
-
KolmogorovSmirnovTest