Class BinomialTest
- java.lang.Object
-
- org.apache.commons.statistics.inference.BinomialTest
-
public final class BinomialTest extends Object
Implements binomial test statistics.Performs an exact test for the statistical significance of deviations from a theoretically expected distribution of observations into two categories.
- Since:
- 1.1
- See Also:
- Binomial test (Wikipedia)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SignificanceResult
test(int numberOfTrials, int numberOfSuccesses, double probability)
Performs a binomial test about the probability of success .BinomialTest
with(AlternativeHypothesis v)
Return an instance with the configured alternative hypothesis.static BinomialTest
withDefaults()
Return an instance using the default options.
-
-
-
Method Detail
-
withDefaults
public static BinomialTest withDefaults()
Return an instance using the default options.- Returns:
- default instance
-
with
public BinomialTest with(AlternativeHypothesis v)
Return an instance with the configured alternative hypothesis.- Parameters:
v
- Value.- Returns:
- an instance
-
test
public SignificanceResult test(int numberOfTrials, int numberOfSuccesses, double probability)
Performs a binomial test about the probability of success .The null hypothesis is
where is between 0 and 1.The probability of observing
successes from trials with a given probability of success is:The test is defined by the
AlternativeHypothesis
.To test
(less than):To test
(greater than):To test
(two-sided) requires finding all such that and compute the sum:The two-sided p-value represents the likelihood of getting a result at least as extreme as the sample, given the provided
probability
of success on a single trial.The test statistic is equal to the estimated proportion
.- Parameters:
numberOfTrials
- Number of trials performed.numberOfSuccesses
- Number of successes observed.probability
- Assumed probability of a single trial under the null hypothesis.- Returns:
- test result
- Throws:
IllegalArgumentException
- ifnumberOfTrials
ornumberOfSuccesses
is negative;probability
is not between 0 and 1; or ifnumberOfTrials < numberOfSuccesses
- See Also:
with(AlternativeHypothesis)
-
-