commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bruno P. Kinoshita (JIRA)" <>
Subject [jira] [Commented] (MATH-1401) Exception at IntervalUtils.getClopperPearsonInterval
Date Tue, 09 May 2017 10:28:04 GMT


Bruno P. Kinoshita commented on MATH-1401:

To make it easier, will start naming the two cases we have. Case #1 is the one I had some
time to study today, and is when **number of successes is equals zero**. And Case #2 is where
**number of successes is equal to the number of trials".

The exception is raised [here|]:

# class: ConfidenceInterval
     * Verifies that (lower, upper) is a valid non-empty interval and confidence
     * is strictly between 0 and 1.
     * @param lower lower endpoint
     * @param upper upper endpoint
     * @param confidence confidence level
    private void checkParameters(double lower, double upper, double confidence) {
        if (lower >= upper) { <---------------------- HERE, both are 0 <=> 0
            throw new MathIllegalArgumentException(LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,
lower, upper);
        if (confidence <= 0 || confidence >= 1) {
            throw new MathIllegalArgumentException(LocalizedFormats.OUT_OF_BOUNDS_CONFIDENCE_LEVEL,
confidence, 0, 1);

The code is checking if the confidence interval lower and upper bounds are different. The
[R code|] handles
three cases, when the number of successes is zero, when the number of successes and trials
is the same, and the case where both previous constraints are not true.

Our code in ClopperPearsonInterval checks if the number of successes is greater than 0 only.
Then returns a ConfidenceInterval object.

My current guess is that by understanding why the R code is treating these three cases, we
may be able to confirm if it makes sense adding some if/else for these constraints in our
Java code too.

> Exception at IntervalUtils.getClopperPearsonInterval
> ----------------------------------------------------
>                 Key: MATH-1401
>                 URL:
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.6.1
>            Reporter: Art
>            Assignee: Bruno P. Kinoshita
>             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

View raw message