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

Phil Steitz commented on MATH-1502:
-----------------------------------

I am sorry, but this is actually a regression in 3.6.1.  There is a bug in the 
way the new implementation handles d values that are not mass points of the KS 
distribution.  This should not effect actual tests, as tests will always return 
attained d values.  This has been fixed in Hipparchus 
[https://github.com/Hipparchus-Math/hipparchus/commit/9718fe2d2842bc9dac63a355702504794454ed63]

The Hipparchus fix also improves the exact computation algorithm to be faster 
and more numerically stable.  I will submit a PR to make similar changes to 
Commons Math if no one beats me to it.  

A simpler fix would be to just copy the normalizeD method in the Hipparchus 
code and recode the d values using it (leaving implementation of exactP 
otherwise unchanged).

 

 

> KolmogorovSmirnovTest#exactP value is incorrect in 3.6.1 potential bug
> ----------------------------------------------------------------------
>
>                 Key: MATH-1502
>                 URL: https://issues.apache.org/jira/browse/MATH-1502
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.6.1
>            Reporter: Ethan Mahintorabi
>            Priority: Critical
>         Attachments: exact_vs_approximate.png
>
>
> I believe that I have found a bug in the calculation of the exactP value in 
> KolmogorovSmirnovTest.java in version 3.6.1.
>  
> In version 3.4.1 KolmogorovSmirnovTest#exactP(0.5633587786259542, 3, 3, true) 
> = 0.6
>  
> Where as
>  
> In version 3.6.1 KolmogorovSmirnovTest#exactP(0.5633587786259542, 3, 3, true) 
> = 0.09999999999999998
>  
>  
> The approximateP value has stayed the same at ~=0.72. This seems to 
> correspond with the change in methods of calculation in 
> e38bbb9f4191d0d21dea0ba31fdc131b97a5597b
>  
> [https://github.com/apache/commons-math/commit/e38bbb9f4191d0d21dea0ba31fdc131b97a5597b#diff-34100572fcc8e6537bc7445a0e82b900]
>  



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

Reply via email to