Class MannWhitneyUTest
java.lang.Object
org.moeaframework.util.statistics.OrdinalStatisticalTest
org.moeaframework.util.statistics.MannWhitneyUTest
- All Implemented Interfaces:
StatisticalTest
The Mann-Whitney U test determines if two populations have different medians.
- Null Hypothesis: The two populations have the same medians.
- Alternative Hypothesis: The two populations have different medians.
Assumptions:
- Samples are randomly selected from their corresponding populations
- Samples are independent
- The dependent variable (value being sampled) is continuous
- The underlying distributions of the populations are identical in shape
References:
- Sheskin, D.J. "Handbook of Parametric and Nonparametric Statistical Procedures, Third Edition." Chapman & Hall/CRC. 2004.
-
Field Summary
Fields inherited from class org.moeaframework.util.statistics.OrdinalStatisticalTest
comparator, data, numberOfGroups -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(double value, int group) Adds a new observation with the specified value and group.voidaddAll(double[] values, int group) Adds several new observations to the specified group.org.apache.commons.math3.stat.descriptive.DescriptiveStatisticsgetStatistics(int group) Returns the descriptive statistics for the given group.booleantest(double alpha) Returnstrueif the null hypothesis is rejected;falseotherwise.Methods inherited from class org.moeaframework.util.statistics.OrdinalStatisticalTest
getComparator, getNumberOfGroups, size, update
-
Constructor Details
-
MannWhitneyUTest
public MannWhitneyUTest()Constructs a Mann-Whitney U test.
-
-
Method Details
-
add
public void add(double value, int group) Description copied from class:OrdinalStatisticalTestAdds a new observation with the specified value and group.- Overrides:
addin classOrdinalStatisticalTest- Parameters:
value- the value of the new observationgroup- the group to which the new observation belongs
-
addAll
public void addAll(double[] values, int group) Description copied from class:OrdinalStatisticalTestAdds several new observations to the specified group.- Overrides:
addAllin classOrdinalStatisticalTest- Parameters:
values- the values of the new observationsgroup- the group to which the new observations belong
-
getStatistics
public org.apache.commons.math3.stat.descriptive.DescriptiveStatistics getStatistics(int group) Description copied from class:OrdinalStatisticalTestReturns the descriptive statistics for the given group.- Overrides:
getStatisticsin classOrdinalStatisticalTest- Parameters:
group- the group- Returns:
- the descriptive statistics
-
test
public boolean test(double alpha) Returnstrueif the null hypothesis is rejected;falseotherwise. 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:
trueif the null hypothesis is rejected;falseotherwise- Throws:
IllegalArgumentException- if an insufficient sampling size is provided, or if an invalid alpha value is provided
-