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

Bruno P. Kinoshita commented on MATH-1401:
------------------------------------------

And in R, the 
[PropCIs|https://artax.karlin.mff.cuni.cz/r-help/library/PropCIs/html/exactci.html]
 library gives:

{code}
library(PropCIs)
exactci(1, 1, 0.95)

data:  

95 percent confidence interval:
 0.025 1.000
{code}

But must admit that I'm abstracting away the fact that there are two functions 
for calculating clopper pearson interval (exactci and midPci). I have some 
links from the PropCIs R vignette (as tutorials are called in R), a [Wikipedia 
page I 
found|https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval#Clopper-Pearson_interval],
 and another [R related web 
page|http://www.stat.cmu.edu/~mciollar/resources/clopper-pearson.html].

The Java code seems to be correctly checking to avoid division by zero and NaN 
errors. However, looking at the R implementation, it seems that we could simply 
add an extra case for when the denominator is zero. Though, instead of simply 
copying the code from other libraries, I intend to read these links before 
fixing the code, in order to learn what are clopper pearson intervals. If 
anyone beats me fixing the code, that'll be all right as well :-)

> 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
>             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
(v6.3.15#6346)

Reply via email to