Class OrdinalStatisticalTest

java.lang.Object
org.moeaframework.util.statistics.OrdinalStatisticalTest
All Implemented Interfaces:
StatisticalTest
Direct Known Subclasses:
KruskalWallisTest, MannWhitneyUTest, WilcoxonSignedRanksTest

public abstract class OrdinalStatisticalTest extends Object implements StatisticalTest
Abstract class for implementing ordinal (rank-based) statistical tests. Methods are provided for storing RankedObservation objects and updating their ranks.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Comparator<RankedObservation>
    The comparator used for ordering observations.
    protected final List<RankedObservation>
    Collection of all ranked observations added to this test.
    protected final int
    The number of groups being tested.
  • Constructor Summary

    Constructors
    Constructor
    Description
    OrdinalStatisticalTest(int numberOfGroups)
    Constructs a new ordinal (rank-based) statistical test for the specified number of groups.
    OrdinalStatisticalTest(int numberOfGroups, Comparator<RankedObservation> comparator)
    Constructs a new ordinal (rank-based) statistical test for the specified number of groups and the comparator for ordering observations.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    add(double value, int group)
    Adds a new observation with the specified value and group.
    protected void
    addAll(double[] values, int group)
    Adds several new observations to the specified group.
    Returns the comparator used by this test to order observations.
    int
    Returns the number of groups being tested.
    protected org.apache.commons.math3.stat.descriptive.DescriptiveStatistics
    getStatistics(int group)
    Returns the descriptive statistics for the given group.
    int
    Returns the number of observations used in this test.
    protected void
    Sorts the observations using the comparator and assigns ranks.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.moeaframework.util.statistics.StatisticalTest

    test
  • Field Details

    • numberOfGroups

      protected final int numberOfGroups
      The number of groups being tested.
    • comparator

      protected final Comparator<RankedObservation> comparator
      The comparator used for ordering observations.
    • data

      protected final List<RankedObservation> data
      Collection of all ranked observations added to this test.
  • Constructor Details

    • OrdinalStatisticalTest

      public OrdinalStatisticalTest(int numberOfGroups)
      Constructs a new ordinal (rank-based) statistical test for the specified number of groups.
      Parameters:
      numberOfGroups - the number of groups being tested
    • OrdinalStatisticalTest

      public OrdinalStatisticalTest(int numberOfGroups, Comparator<RankedObservation> comparator)
      Constructs a new ordinal (rank-based) statistical test for the specified number of groups and the comparator for ordering observations.
      Parameters:
      numberOfGroups - the number of groups being tested
      comparator - the comparator for ordering observations
  • Method Details

    • add

      protected void add(double value, int group)
      Adds a new observation with the specified value and group.
      Parameters:
      value - the value of the new observation
      group - the group to which the new observation belongs
    • addAll

      protected void addAll(double[] values, int group)
      Adds several new observations to the specified group.
      Parameters:
      values - the values of the new observations
      group - the group to which the new observations belong
    • update

      protected void update()
      Sorts the observations using the comparator and assigns ranks.
    • size

      public int size()
      Returns the number of observations used in this test.
      Returns:
      the number of observations used in this test
    • getNumberOfGroups

      public int getNumberOfGroups()
      Returns the number of groups being tested.
      Returns:
      the number of groups being tested
    • getStatistics

      protected org.apache.commons.math3.stat.descriptive.DescriptiveStatistics getStatistics(int group)
      Returns the descriptive statistics for the given group.
      Parameters:
      group - the group
      Returns:
      the descriptive statistics
    • getComparator

      public Comparator<RankedObservation> getComparator()
      Returns the comparator used by this test to order observations.
      Returns:
      the comparator used by this test to order observations