public class MannWhitneyUTest
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private NaturalRanking |
naturalRanking
Ranking algorithm.
|
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
private double |
calculateAsymptoticPValue(double Umin,
int n1,
int n2) |
private double[] |
concatenateSamples(double[] x,
double[] y)
Concatenate the samples into one array.
|
private void |
ensureDataConformance(double[] x,
double[] y)
Ensures that the provided arrays fulfills the assumptions.
|
double |
mannWhitneyU(double[] x,
double[] y)
Computes the Mann-Whitney
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
p-value, associated with a Mann-Whitney
U statistic comparing mean for two independent samples.
|
private NaturalRanking naturalRanking
public MannWhitneyUTest()
public MannWhitneyUTest(NaNStrategy nanStrategy, TiesStrategy tiesStrategy)
nanStrategy
- specifies the strategy that should be used for Double.NaN'stiesStrategy
- specifies the strategy that should be used for tiesprivate void ensureDataConformance(double[] x, double[] y) throws NullArgumentException, NoDataException
x
- first sampley
- second sampleNullArgumentException
- if x
or y
are null
.NoDataException
- if x
or y
are zero-length.private double[] concatenateSamples(double[] x, double[] y)
x
- first sampley
- second samplepublic double mannWhitneyU(double[] x, double[] y) throws NullArgumentException, NoDataException
This statistic can be used to perform a Mann-Whitney U test evaluating the null hypothesis that the two independent samples has equal mean.
Let Xi denote the i'th individual of the first sample and Yj the j'th individual in the second sample. Note that the samples would often have different length.
Preconditions:
x
- the first sampley
- the second sampleNullArgumentException
- if x
or y
are null
.NoDataException
- if x
or y
are zero-length.private double calculateAsymptoticPValue(double Umin, int n1, int n2) throws ConvergenceException, MaxCountExceededException
Umin
- smallest Mann-Whitney U valuen1
- number of subjects in first samplen2
- number of subjects in second sampleConvergenceException
- if the p-value can not be computed
due to a convergence errorMaxCountExceededException
- if the maximum number of
iterations is exceededpublic double mannWhitneyUTest(double[] x, double[] y) throws NullArgumentException, NoDataException, ConvergenceException, MaxCountExceededException
Let Xi denote the i'th individual of the first sample and Yj the j'th individual in the second sample. Note that the samples would often have different length.
Preconditions:
Ties give rise to biased variance at the moment. See e.g. http://mlsc.lboro.ac.uk/resources/statistics/Mannwhitney.pdf.
x
- the first sampley
- the second sampleNullArgumentException
- if x
or y
are null
.NoDataException
- if x
or y
are zero-length.ConvergenceException
- if the p-value can not be computed due to a
convergence errorMaxCountExceededException
- if the maximum number of iterations
is exceededCopyright (c) 2003-2016 Apache Software Foundation