Class WilcoxonSignedRanksTest

java.lang.Object
org.moeaframework.util.statistics.OrdinalStatisticalTest
org.moeaframework.util.statistics.WilcoxonSignedRanksTest
All Implemented Interfaces:
StatisticalTest

public class WilcoxonSignedRanksTest extends OrdinalStatisticalTest
The Wilcoxon Signed-Ranks test determines if the population median is equal to a specified value.
  • Null Hypothesis: The population median equals X.
  • Alternative Hypothesis: The population median does not equal X.

Assumptions:

  1. Samples are randomly selected from the population
  2. The underlying population distribution is symmetrical

References:

  1. Sheskin, D.J. "Handbook of Parametric and Nonparametric Statistical Procedures, Third Edition." Chapman & Hall/CRC. 2004.
  • Constructor Details

    • WilcoxonSignedRanksTest

      public WilcoxonSignedRanksTest(double median)
      Constructs a Wilcoxon signed ranks test with the specified median.
      Parameters:
      median - the value being tested against the population median
  • Method Details

    • getMedian

      public double getMedian()
      Returns the value being tested against the population median.
      Returns:
      the value being tested against the population median
    • add

      public void add(double value)
      Adds a new observation with the specified value.
      Parameters:
      value - the value of the new observation
    • addAll

      public void addAll(double[] values)
      Adds several new observations with the specified values.
      Parameters:
      values - the values of the new observations
    • test

      public boolean test(double alpha)
      Returns true if the null hypothesis is rejected; false otherwise. The meaning of the null hypothesis and alternative hypothesis depends on the specific test.

      The prespecified level of confidence, alpha, can be used for either one-tailed or two-tailed (directional or non-directional) distributions, depending on the specific test. Some tests may only support specific values for alpha.

      When the samples from both populations are less than 20, only alpha values of 0.05 and 0.01 are valid. This is because a table is used to accurately determine the critical values. When more than 20 samples are available, the normal approximation is used allowing any value for alpha.

      Parameters:
      alpha - the prespecified level of confidence
      Returns:
      true if the null hypothesis is rejected; false otherwise
      Throws:
      IllegalArgumentException - if an insufficient sampling size is provided, or if an invalid alpha value is provided