[ 
https://issues.apache.org/jira/browse/MATH-1535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17119580#comment-17119580
 ] 

Gilles Sadowski commented on MATH-1535:
---------------------------------------

I also did some testing.
 Increasing the range is dangerous: In a unit test, it overflowed (triggering 
an exception by the RNG), meaning that in some cases (that do not raise an 
exception), the return value will just be nonsense.
{quote}[...] increasing the number of loops in fixTies to 10000.
{quote}
Does that seem a reasonable value?
 I don't know what the impact is (on the returned value) when the ordering is 
changed to the jitter; in case it is important, perhaps a {{checkFixTies}} 
should be enforced in the main code (?).

I noticed that one of the current unit tests would fail with another value of 
the RNG seed in the {{jitter}} method.
 The test is insanely sensitive to the seed: 100000 loops are not sufficient! 
While for that other value, your test above passes with less than 1000 loops!

This seems another sign that this approach is flawed (?).
 Perhaps we should do the same as in "R" (?). If you'd like to provide a 
patch...

> MathInternalError in KolmogorovSmirnovTest in case of many ties
> ---------------------------------------------------------------
>
>                 Key: MATH-1535
>                 URL: https://issues.apache.org/jira/browse/MATH-1535
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.6.1
>         Environment: commons-math 3.6.1, oracle jdk11 for windows
>            Reporter: Steffen Herbold
>            Priority: Major
>
> I encounter a math internal error with some very ugly data that has lots of 
> ties. The code below triggers the exception. I could try to build in a 
> detection in my code that identifies this strange case where the generated 
> data has many ties, to avoid this. But I guess the MathInternalError in 
> commons-math should still be avoided. 
>  
> {code:java}
> // works
> double[] sample1 = new double[] {0.8767630865438496, 0.9998809418147052, 
> 0.9999999715463531, 0.9999985849345421};
> double[] sample2 = new double[] {1.0, 1.0, 1.0, 1.0};
> ksTest.kolmogorovSmirnovTest(sample1, sample2);
> // fails with illegal state
> double[] sample3 = new double[] {0.8767630865438496, 0.9998809418147052, 
> 0.9999999715463531, 0.9999985849345421, 0.973584315883326, 
> 0.9999999875782982, 0.999999999999994, 0.9999999999908233, 1.0, 
> 0.9999999890925574, 0.9999998345734327, 0.9999999350772448, 
> 0.999999999999426, 0.9999147040688201, 0.9999999999999922, 1.0, 1.0, 
> 0.9919050954798272, 0.8649014770687263, 0.9990869497973084, 
> 0.9993222540990464, 0.999999999998189, 0.9999999999999365, 
> 0.9790934801762917, 0.9999578695006303, 0.9999999999999998, 
> 0.999999999996166, 0.9999999999995546, 0.9999999999908036, 0.99999999999744, 
> 0.9999998802655555, 0.9079334221214075, 0.9794398308007372, 
> 0.9999044231134367, 0.9999999999999813, 0.9999957841707683, 
> 0.9277678892094009, 0.999948269893843, 0.9999999886132888, 
> 0.9999998909699096, 0.9999099536620326, 0.9999999962217623, 
> 0.9138936987350447, 0.9999999999779976, 0.999999999998822, 0.999979247207911, 
> 0.9926904388316407, 1.0, 0.9999999999998814, 1.0, 0.9892505696426215, 
> 0.9999996514123723, 0.9999999999999429, 0.9999999995399116, 
> 0.999999999948221, 0.7358264887843119, 0.9999999994098534, 1.0, 
> 0.9999986456748472, 1.0, 0.9999999999921501, 0.9999999999999996, 
> 0.9999999999999944, 0.9473070068606853, 0.9993714060209042, 
> 0.9999999409098718, 0.9999999592791519, 0.9999999999999805};
> double[] sample4 = new double[] {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 
> 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 
> 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 
> 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 
> 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 
> 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 
> 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 
> 1.0};
> ksTest.kolmogorovSmirnovTest(sample3, sample4);
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to