/** * Returns whether the null hypothesis can be rejected with the given confidence level. * <p> * <strong>Preconditions</strong>: * <ul> * <li>Number of trials must be ≥ 0.</li> * <li>Number of successes must be ≥ 0.</li> * <li>Number of successes must be ≤ number of trials.</li> * <li>Probability must be ≥ 0 and ≤ 1.</li> * </ul> * * @param numberOfTrials number of trials performed * @param numberOfSuccesses number of successes observed * @param probability assumed probability of a single trial under the null hypothesis * @param alternativeHypothesis type of hypothesis being evaluated (one- or two-sided) * @param alpha significance level of the test * @return true if the null hypothesis can be rejected with confidence {@code 1 - alpha} * @throws NotPositiveException if {@code numberOfTrials} or {@code numberOfSuccesses} is negative * @throws OutOfRangeException if {@code probability} is not between 0 and 1 * @throws MathIllegalArgumentException if {@code numberOfTrials} < {@code numberOfSuccesses} or * if {@code alternateHypothesis} is null. * @see AlternativeHypothesis */ public boolean binomialTest(int numberOfTrials, int numberOfSuccesses, double probability, AlternativeHypothesis alternativeHypothesis, double alpha) { double pValue = binomialTest(numberOfTrials, numberOfSuccesses, probability, alternativeHypothesis); return pValue < alpha; }
/** * Returns whether the null hypothesis can be rejected with the given confidence level. * <p> * <strong>Preconditions</strong>: * <ul> * <li>Number of trials must be ≥ 0.</li> * <li>Number of successes must be ≥ 0.</li> * <li>Number of successes must be ≤ number of trials.</li> * <li>Probability must be ≥ 0 and ≤ 1.</li> * </ul> * * @param numberOfTrials number of trials performed * @param numberOfSuccesses number of successes observed * @param probability assumed probability of a single trial under the null hypothesis * @param alternativeHypothesis type of hypothesis being evaluated (one- or two-sided) * @param alpha significance level of the test * @return true if the null hypothesis can be rejected with confidence {@code 1 - alpha} * @throws NotPositiveException if {@code numberOfTrials} or {@code numberOfSuccesses} is negative * @throws OutOfRangeException if {@code probability} is not between 0 and 1 * @throws MathIllegalArgumentException if {@code numberOfTrials} < {@code numberOfSuccesses} or * if {@code alternateHypothesis} is null. * @see AlternativeHypothesis */ public boolean binomialTest(int numberOfTrials, int numberOfSuccesses, double probability, AlternativeHypothesis alternativeHypothesis, double alpha) { double pValue = binomialTest(numberOfTrials, numberOfSuccesses, probability, alternativeHypothesis); return pValue < alpha; }
/** * Returns whether the null hypothesis can be rejected with the given confidence level. * <p> * <strong>Preconditions</strong>: * <ul> * <li>Number of trials must be ≥ 0.</li> * <li>Number of successes must be ≥ 0.</li> * <li>Number of successes must be ≤ number of trials.</li> * <li>Probability must be ≥ 0 and ≤ 1.</li> * </ul> * * @param numberOfTrials number of trials performed * @param numberOfSuccesses number of successes observed * @param probability assumed probability of a single trial under the null hypothesis * @param alternativeHypothesis type of hypothesis being evaluated (one- or two-sided) * @param alpha significance level of the test * @return true if the null hypothesis can be rejected with confidence {@code 1 - alpha} * @throws NotPositiveException if {@code numberOfTrials} or {@code numberOfSuccesses} is negative * @throws OutOfRangeException if {@code probability} is not between 0 and 1 * @throws MathIllegalArgumentException if {@code numberOfTrials} < {@code numberOfSuccesses} or * if {@code alternateHypothesis} is null. * @see AlternativeHypothesis */ public boolean binomialTest(int numberOfTrials, int numberOfSuccesses, double probability, AlternativeHypothesis alternativeHypothesis, double alpha) { double pValue = binomialTest(numberOfTrials, numberOfSuccesses, probability, alternativeHypothesis); return pValue < alpha; }