Class MannWhitneyUTest
 java.lang.Object

 org.apache.commons.math4.legacy.stat.inference.MannWhitneyUTest

public class MannWhitneyUTest extends Object
An implementation of the MannWhitney U test (also called Wilcoxon ranksum test).


Constructor Summary
Constructors Constructor Description MannWhitneyUTest()
Create a test instance using where NaN's are left in place and ties get the average of applicable ranks.MannWhitneyUTest(NaNStrategy nanStrategy, TiesStrategy tiesStrategy)
Create a test instance using the given strategies for NaN's and ties.

Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
mannWhitneyU(double[] x, double[] y)
Computes the MannWhitney U statistic comparing mean for two independent samples possibly of different length.double
mannWhitneyUTest(double[] x, double[] y)
Returns the asymptotic observed significance level, or pvalue, associated with a MannWhitney U statistic comparing mean for two independent samples.



Constructor Detail

MannWhitneyUTest
public MannWhitneyUTest()
Create a test instance using where NaN's are left in place and ties get the average of applicable ranks. Use this unless you are very sure of what you are doing.

MannWhitneyUTest
public MannWhitneyUTest(NaNStrategy nanStrategy, TiesStrategy tiesStrategy)
Create a test instance using the given strategies for NaN's and ties. Only use this if you are sure of what you are doing. Parameters:
nanStrategy
 specifies the strategy that should be used for Double.NaN'stiesStrategy
 specifies the strategy that should be used for ties


Method Detail

mannWhitneyU
public double mannWhitneyU(double[] x, double[] y) throws NullArgumentException, NoDataException
Computes the MannWhitney U statistic comparing mean for two independent samples possibly of different length.This statistic can be used to perform a MannWhitney U test evaluating the null hypothesis that the two independent samples has equal mean.
Let X_{i} denote the i'th individual of the first sample and Y_{j} the j'th individual in the second sample. Note that the samples would often have different length.
Preconditions:
 All observations in the two samples are independent.
 The observations are at least ordinal (continuous are also ordinal).
 Parameters:
x
 the first sampley
 the second sample Returns:
 MannWhitney U statistic (minimum of U^{x} and U^{y})
 Throws:
NullArgumentException
 ifx
ory
arenull
.NoDataException
 ifx
ory
are zerolength.

mannWhitneyUTest
public double mannWhitneyUTest(double[] x, double[] y) throws NullArgumentException, NoDataException, ConvergenceException, MaxCountExceededException
Returns the asymptotic observed significance level, or pvalue, associated with a MannWhitney U statistic comparing mean for two independent samples.Let X_{i} denote the i'th individual of the first sample and Y_{j} the j'th individual in the second sample. Note that the samples would often have different length.
Preconditions:
 All observations in the two samples are independent.
 The observations are at least ordinal (continuous are also ordinal).
Ties give rise to biased variance at the moment. See e.g. http://mlsc.lboro.ac.uk/resources/statistics/Mannwhitney.pdf.
 Parameters:
x
 the first sampley
 the second sample Returns:
 asymptotic pvalue
 Throws:
NullArgumentException
 ifx
ory
arenull
.NoDataException
 ifx
ory
are zerolength.ConvergenceException
 if the pvalue can not be computed due to a convergence errorMaxCountExceededException
 if the maximum number of iterations is exceeded

