Thanks Thomas, that worked :). I'm not yet too familiar with the statistics background, but I guess I'll spend some more time with it and if I really got it, I'll write a patch for a binomial test.
Cheers, Thorsten Am 9/11/13 4:42 PM schrieb "Thomas Neidhart" unter <[email protected]>: >On 09/11/2013 08:37 PM, [email protected] wrote: >> We have a sample which comes from a binomial process with unknown >>probability. Is it possible to get the likelihood of the population is >>larger than a user-specified value (with e.g. 95% certainty) in >>commons-math? >> For example, given we have two samples: >> S1: we have 4 out of 5 successes >> S2: we have 80 out of 100 successes >> >> I would like to know the probability that the real mean is larger than >>60% given one of the samples above. Is there an easy way to calculate it? > >Hi Thorsten, > >there is not yet a binomial test available (would be a nice addition), >but you can calculate the requested values with the binomial distribution: > >// create a binomial distribution with null hypothesis of p=0.6 >BinomialDistribution s1 = new BinomialDistribution(5, 0.6); >System.out.println(1 - s1.cumulativeProbability(4-1)); > >// = 0.3369 > 0.05 significance level >// thus null hypothesis can not be rejected > >BinomialDistribution s2 = new BinomialDistribution(100, 0.6); >System.out.println(1 - s2.cumulativeProbability(80-1)); > >// = 1.64e-5 < 0.05 significance level >// thus null hypothesis can be rejected >// the observed probability must be larger > >Note: the - 1 is used to get the same results as with R binom.test >see also >http://stats.stackexchange.com/questions/44125/is-there-an-error-in-the-on >e-sided-binomial-test-in-r > > >Best regards, > >Thomas > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [email protected] >For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
