KolmogorovSmirnovTestpublic class KolmogorovSmirnovDistribution
extends java.lang.Object
implements java.io.Serializable
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:
| Modifier and Type | Field and Description |
|---|---|
private int |
n
Deprecated.
Number of observations.
|
private static long |
serialVersionUID
Deprecated.
Serializable version identifier.
|
| Constructor and Description |
|---|
KolmogorovSmirnovDistribution(int n)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
double |
cdf(double d)
Deprecated.
Calculates
P(D_n < d) using method described in [1] with quick
decisions for extreme values given in [2] (see above). |
double |
cdf(double d,
boolean exact)
Deprecated.
Calculates
P(D_n < d) using method described in [1] with quick
decisions for extreme values given in [2] (see above). |
double |
cdfExact(double d)
Deprecated.
Calculates
P(D_n < d) using method described in [1] with quick
decisions for extreme values given in [2] (see above). |
private FieldMatrix<BigFraction> |
createH(double d)
Deprecated.
Creates
H of size m x m as described in [1] (see above). |
private double |
exactK(double d)
Deprecated.
Calculates the exact value of
P(D_n < d) using method described
in [1] and BigFraction (see
above). |
private double |
roundedK(double d)
Deprecated.
Calculates
P(D_n < d) using method described in [1] and doubles
(see above). |
private static final long serialVersionUID
private int n
public KolmogorovSmirnovDistribution(int n)
throws NotStrictlyPositiveException
n - Number of observationsNotStrictlyPositiveException - if n <= 0public double cdf(double d)
throws MathArithmeticException
P(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 with
cdfExact(double) because
calculations are based on double rather than
BigFraction.d - statisticP(D_n < d)MathArithmeticException - if algorithm fails to convert h
to a BigFraction in expressing
d as (k - h) / m for integer k, m and
0 <= h < 1.public double cdfExact(double d)
throws MathArithmeticException
P(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 choose
cdf(double)d - statisticP(D_n < d)MathArithmeticException - if algorithm fails to convert h
to a BigFraction in expressing
d as (k - h) / m for integer k, m and
0 <= h < 1.public double cdf(double d,
boolean exact)
throws MathArithmeticException
P(D_n < d) using method described in [1] with quick
decisions for extreme values given in [2] (see above).d - statisticexact - whether the probability should be calculated exact using
BigFraction everywhere at the
expense of very slow execution time, or if double should be used
convenient places to gain speed. Almost never choose true in real
applications unless you are very sure; true is almost solely for
verification purposes.P(D_n < d)MathArithmeticException - if algorithm fails to convert h
to a BigFraction in expressing
d as (k - h) / m for integer k, m and
0 <= h < 1.private double exactK(double d)
throws MathArithmeticException
P(D_n < d) using method described
in [1] and BigFraction (see
above).d - statisticP(D_n < d)MathArithmeticException - if algorithm fails to convert h
to a BigFraction in expressing
d as (k - h) / m for integer k, m and
0 <= h < 1.private double roundedK(double d)
throws MathArithmeticException
P(D_n < d) using method described in [1] and doubles
(see above).d - statisticP(D_n < d)MathArithmeticException - if algorithm fails to convert h
to a BigFraction in expressing
d as (k - h) / m for integer k, m and
0 <= h < 1.private FieldMatrix<BigFraction> createH(double d) throws NumberIsTooLargeException, FractionConversionException
H of size m x m as described in [1] (see above).d - statisticNumberIsTooLargeException - if fractional part is greater than 1FractionConversionException - if algorithm fails to convert
h to a BigFraction in
expressing d as (k - h) / m for integer k, m and
0 <= h < 1.Copyright (c) 2003-2015 Apache Software Foundation