|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math3.stat.inference.WilcoxonSignedRankTest
public class WilcoxonSignedRankTest
An implementation of the Wilcoxon signed-rank test.
Field Summary | |
---|---|
private NaturalRanking |
naturalRanking
Ranking algorithm. |
Constructor Summary | |
---|---|
WilcoxonSignedRankTest()
Create a test instance where NaN's are left in place and ties get the average of applicable ranks. |
|
WilcoxonSignedRankTest(NaNStrategy nanStrategy,
TiesStrategy tiesStrategy)
Create a test instance using the given strategies for NaN's and ties. |
Method Summary | |
---|---|
private double[] |
calculateAbsoluteDifferences(double[] z)
Calculates |z[i]| for all i |
private double |
calculateAsymptoticPValue(double Wmin,
int N)
|
private double[] |
calculateDifferences(double[] x,
double[] y)
Calculates y[i] - x[i] for all i |
private double |
calculateExactPValue(double Wmax,
int N)
Algorithm inspired by http://www.fon.hum.uva.nl/Service/Statistics/Signed_Rank_Algorihms.html#C by Rob van Son, Institute of Phonetic Sciences & IFOTT, University of Amsterdam |
private void |
ensureDataConformance(double[] x,
double[] y)
Ensures that the provided arrays fulfills the assumptions. |
double |
wilcoxonSignedRank(double[] x,
double[] y)
Computes the Wilcoxon signed ranked statistic comparing mean for two related samples or repeated measurements on a single sample. |
double |
wilcoxonSignedRankTest(double[] x,
double[] y,
boolean exactPValue)
Returns the observed significance level, or p-value, associated with a Wilcoxon signed ranked statistic comparing mean for two related samples or repeated measurements on a single sample. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private NaturalRanking naturalRanking
Constructor Detail |
---|
public WilcoxonSignedRankTest()
public WilcoxonSignedRankTest(NaNStrategy nanStrategy, TiesStrategy tiesStrategy)
nanStrategy
- specifies the strategy that should be used for Double.NaN'stiesStrategy
- specifies the strategy that should be used for tiesMethod Detail |
---|
private void ensureDataConformance(double[] x, double[] y) throws NullArgumentException, NoDataException, DimensionMismatchException
x
- first sampley
- second sample
NullArgumentException
- if x
or y
are null
.
NoDataException
- if x
or y
are zero-length.
DimensionMismatchException
- if x
and y
do not
have the same length.private double[] calculateDifferences(double[] x, double[] y)
x
- first sampley
- second sample
private double[] calculateAbsoluteDifferences(double[] z) throws NullArgumentException, NoDataException
z
- sample
NullArgumentException
- if z
is null
NoDataException
- if z
is zero-length.public double wilcoxonSignedRank(double[] x, double[] y) throws NullArgumentException, NoDataException, DimensionMismatchException
This statistic can be used to perform a Wilcoxon signed ranked test evaluating the null hypothesis that the two related samples or repeated measurements on a single sample has equal mean.
Let Xi denote the i'th individual of the first sample and Yi the related i'th individual in the second sample. Let Zi = Yi - Xi.
Preconditions:
x
- the first sampley
- the second sample
NullArgumentException
- if x
or y
are null
.
NoDataException
- if x
or y
are zero-length.
DimensionMismatchException
- if x
and y
do not
have the same length.private double calculateExactPValue(double Wmax, int N)
Wmax
- largest Wilcoxon signed rank valueN
- number of subjects (corresponding to x.length)
private double calculateAsymptoticPValue(double Wmin, int N)
Wmin
- smallest Wilcoxon signed rank valueN
- number of subjects (corresponding to x.length)
public double wilcoxonSignedRankTest(double[] x, double[] y, boolean exactPValue) throws NullArgumentException, NoDataException, DimensionMismatchException, NumberIsTooLargeException, ConvergenceException, MaxCountExceededException
Let Xi denote the i'th individual of the first sample and Yi the related i'th individual in the second sample. Let Zi = Yi - Xi.
Preconditions:
x
- the first sampley
- the second sampleexactPValue
- if the exact p-value is wanted (only works for x.length <= 30,
if true and x.length > 30, this is ignored because
calculations may take too long)
NullArgumentException
- if x
or y
are null
.
NoDataException
- if x
or y
are zero-length.
DimensionMismatchException
- if x
and y
do not
have the same length.
NumberIsTooLargeException
- if exactPValue
is true
and x.length
> 30
ConvergenceException
- if the p-value can not be computed due to
a convergence error
MaxCountExceededException
- if the maximum number of iterations
is exceeded
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |