public class BinomialTest extends Object
Exact test for the statistical significance of deviations from a theoretically expected distribution of observations into two categories.
Constructor and Description 

BinomialTest() 
Modifier and Type  Method and Description 

double 
binomialTest(int numberOfTrials,
int numberOfSuccesses,
double probability,
AlternativeHypothesis alternativeHypothesis)
Returns the observed significance level, or
pvalue,
associated with a Binomial test.

boolean 
binomialTest(int numberOfTrials,
int numberOfSuccesses,
double probability,
AlternativeHypothesis alternativeHypothesis,
double alpha)
Returns whether the null hypothesis can be rejected with the given confidence level.

public boolean binomialTest(int numberOfTrials, int numberOfSuccesses, double probability, AlternativeHypothesis alternativeHypothesis, double alpha)
Preconditions:
numberOfTrials
 number of trials performednumberOfSuccesses
 number of successes observedprobability
 assumed probability of a single trial under the null hypothesisalternativeHypothesis
 type of hypothesis being evaluated (one or twosided)alpha
 significance level of the test1  alpha
MathIllegalArgumentException
 if numberOfTrials
or numberOfSuccesses
is negativeMathIllegalArgumentException
 if probability
is not between 0 and 1MathIllegalArgumentException
 if numberOfTrials
< numberOfSuccesses
or
if alternateHypothesis
is null.AlternativeHypothesis
public double binomialTest(int numberOfTrials, int numberOfSuccesses, double probability, AlternativeHypothesis alternativeHypothesis)
The number returned is the smallest significance level at which one can reject the null hypothesis.
The form of the hypothesis depends on alternativeHypothesis
.
The pValue represents the likelihood of getting a result at least as extreme as the sample,
given the provided probability
of success on a single trial. For singlesided tests,
this value can be directly derived from the Binomial distribution. For the twosided test,
the implementation works as follows: we start by looking at the most extreme cases
(0 success and n success where n is the number of trials from the sample) and determine their likelihood.
The lower value is added to the pValue (if both values are equal, both are added). Then we continue with
the next extreme value, until we added the value for the actual observed sample.
Preconditions:
numberOfTrials
 number of trials performednumberOfSuccesses
 number of successes observedprobability
 assumed probability of a single trial under the null hypothesisalternativeHypothesis
 type of hypothesis being evaluated (one or twosided)MathIllegalArgumentException
 if numberOfTrials
or numberOfSuccesses
is negativeMathIllegalArgumentException
 if probability
is not between 0 and 1MathIllegalArgumentException
 if numberOfTrials
< numberOfSuccesses
or
if alternateHypothesis
is null.AlternativeHypothesis
Copyright © 20162022 CS GROUP. All rights reserved.