You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Michele De Stefano (JIRA)" <ji...@apache.org> on 2019/04/14 17:28:00 UTC

[jira] [Commented] (MATH-1401) Exception at IntervalUtils.getClopperPearsonInterval

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

Michele De Stefano commented on MATH-1401:
------------------------------------------

Dear all, this issue is still present.

I've found an elegant solution (from another developer) that requires very few modifications.

Look here: [ModifiedClopperPearsonInterval.java|https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&cad=rja&uact=8&ved=2ahUKEwigvbLVjNDhAhWOneAKHQ64CFEQFjACegQIBRAB&url=https%3A%2F%2Fgithub.com%2Fkomiya-atsushi%2Fbinomial-proportion-confidence-interval%2Fblob%2Fmaster%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fcommons%2Fmath3%2Fstat%2Finterval%2FModifiedClopperPearsonInterval.java&usg=AOvVaw18pyz4IhNzmgTo1MAH-brE]

Basically, it is sufficient to set the default for the upper bound to 1, and to perform the computation of the upper bound only when the number of successes is less than the number of trials (this is a check to be added).

I checked the correctness of the results against the same computation performed by the statsmodels Python package.

> Exception at IntervalUtils.getClopperPearsonInterval
> ----------------------------------------------------
>
>                 Key: MATH-1401
>                 URL: https://issues.apache.org/jira/browse/MATH-1401
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.6.1
>            Reporter: Art
>            Assignee: Bruno P. Kinoshita
>            Priority: Major
>             Fix For: 4.0
>
>
> IntervalUtils.getClopperPearsonInterval throws an exception when number of successes equals to zero or number of successes = number of trials.
> IntervalUtils.getClopperPearsonInterval(1, 0, 0.95) or IntervalUtils.getClopperPearsonInterval(1, 1, 0.95) throws org.apache.commons.math3.exception.NotStrictlyPositiveException despite that its input parameters are valid. 
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)