commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Otmar Ertl (JIRA)" <>
Subject [jira] [Commented] (MATH-1246) Kolmogorov-Smirnov 2-sample test does not correctly handle ties
Date Mon, 14 Sep 2015 19:35:48 GMT


Otmar Ertl commented on MATH-1246:

I still have doubts:
# There is a difference, if there are ties within one sample, or if the same value exists
at least once in both samples. In the first case the D-statistic is well defined. In the latter
case the D-statistic is undefined. For example, if x = (1, 3, 3, 5) and y = (2, 4, 4, 6) D
= 0.5. On the other hand, if  x = (1, 3, 3, 5) and y = (2, 3, 3, 6) the D-statistic could
be any value  between 0.25 and 0.75. The current implementation returns the minimum (0.25
in this case), but this seems to be a quite arbitrary choice. Furthermore, the implementation
does not distinguish between these two cases (see hasTies() method).
# If the current implementation of exactP() follows the definition you described, I do not
really understand why the following two statements return different values:
new KolmogorovSmirnovTest().exactP(new double[]{0.9, 1.0, 1.1}, new double[]{0.0, 0.0}, false)
new KolmogorovSmirnovTest().exactP(new double[]{1.0, 1.0, 1.0}, new double[]{0.0, 0.0}, false)
The D-statistic is well-defined and equal to 1 in both cases.
# \[1\] describes estimating the p-Value using bootstrapping. I am not sure, if an exact definition
can be derived from there, since bootstrapping in general is not a consistent  estimation

> Kolmogorov-Smirnov 2-sample test does not correctly handle ties
> ---------------------------------------------------------------
>                 Key: MATH-1246
>                 URL:
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Phil Steitz
> For small samples, KolmogorovSmirnovTest(double[], double[]) computes the distribution
of a D-statistic for m-n sets with no ties.  No warning or special handling is delivered in
the presence of ties.

This message was sent by Atlassian JIRA

View raw message