You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gilles Sadowski (Jira)" <ji...@apache.org> on 2022/04/08 15:35:00 UTC

[jira] [Updated] (MATH-1644) BinomialTest returns p-values > 1

     [ https://issues.apache.org/jira/browse/MATH-1644?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gilles Sadowski updated MATH-1644:
----------------------------------
    Attachment: patch

> BinomialTest returns p-values > 1
> ---------------------------------
>
>                 Key: MATH-1644
>                 URL: https://issues.apache.org/jira/browse/MATH-1644
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.6.1
>            Reporter: Chad Young
>            Priority: Minor
>         Attachments: patch
>
>
>  
> The code below produces the output "P-value for 10 trials, 5 successes, probability 0.5, two-sided alternative is 1.2460937500000002", but p-values should never be greater than 1. I think what is happening is that the test is adding both one-sided alternatives, but both include the 5 successes probability, so it is counted twice. This happens whenever the number of successes is exactly what is expected based on number of trials and success probability (numberOfSuccesses = numberOfTrials * probability).
> {code:java}
> import org.apache.commons.math3.stat.inference.*;
> public class Main {
>      public static void main(String args[]) {
>         BinomialTest bt = new BinomialTest();
>         Double pval = bt.binomialTest(10, 5, 0.5, AlternativeHypothesis.TWO_SIDED);
>         System.out.println("P-value for 10 trials, 5 successes, probability 0.5, two-sided alternative is " + pval);
>     }
> }
> {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)