Class OrdinalStatisticalTest
java.lang.Object
org.moeaframework.util.statistics.OrdinalStatisticalTest
- All Implemented Interfaces:
StatisticalTest
- Direct Known Subclasses:
KruskalWallisTest
,MannWhitneyUTest
,WilcoxonSignedRanksTest
Abstract class for implementing ordinal (rank-based) statistical tests. Methods are provided for storing
RankedObservation
objects and updating their ranks.-
Field Summary
Modifier and TypeFieldDescriptionprotected 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
ConstructorDescriptionOrdinalStatisticalTest
(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 TypeMethodDescriptionprotected 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
size()
Returns the number of observations used in this test.protected void
update()
Sorts the observations using thecomparator
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 numberOfGroupsThe number of groups being tested. -
comparator
The comparator used for ordering observations. -
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
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 testedcomparator
- 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 observationgroup
- 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 observationsgroup
- the group to which the new observations belong
-
update
protected void update()Sorts the observations using thecomparator
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
Returns the comparator used by this test to order observations.- Returns:
- the comparator used by this test to order observations
-