org.apache.commons.math3.stat.inference

## Class WilcoxonSignedRankTest

- java.lang.Object
- org.apache.commons.math3.stat.inference.WilcoxonSignedRankTest

public class WilcoxonSignedRankTestextends Object

An implementation of the Wilcoxon signed-rank test.

### Constructor Summary

Constructors Constructor and Description **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

Methods Modifier and Type Method and Description `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.

### Constructor Detail

#### WilcoxonSignedRankTest

public WilcoxonSignedRankTest()

Create a test instance 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.

#### WilcoxonSignedRankTest

public WilcoxonSignedRankTest(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's`tiesStrategy`

- specifies the strategy that should be used for ties

### Method Detail

#### wilcoxonSignedRank

public double wilcoxonSignedRank(double[] x, double[] y) throws NullArgumentException, NoDataException, DimensionMismatchException

Computes the Wilcoxon signed ranked statistic comparing mean for two related samples or repeated measurements on a single sample.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 X

_{i}denote the i'th individual of the first sample and Y_{i}the related i'th individual in the second sample. Let Z_{i}= Y_{i}- X_{i}.**Preconditions**:- The differences Z
_{i}must be independent. - Each Z
_{i}comes from a continuous population (they must be identical) and is symmetric about a common median. - The values that X
_{i}and Y_{i}represent are ordered, so the comparisons greater than, less than, and equal to are meaningful.

- Parameters:
`x`

- the first sample`y`

- the second sample- Returns:
- wilcoxonSignedRank statistic (the larger of W+ and W-)
- Throws:
`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.

- The differences Z

#### wilcoxonSignedRankTest

public double wilcoxonSignedRankTest(double[] x, double[] y, boolean exactPValue) throws NullArgumentException, NoDataException, DimensionMismatchException, NumberIsTooLargeException, ConvergenceException, MaxCountExceededException

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.Let X

_{i}denote the i'th individual of the first sample and Y_{i}the related i'th individual in the second sample. Let Z_{i}= Y_{i}- X_{i}.**Preconditions**:- The differences Z
_{i}must be independent. - Each Z
_{i}comes from a continuous population (they must be identical) and is symmetric about a common median. - The values that X
_{i}and Y_{i}represent are ordered, so the comparisons greater than, less than, and equal to are meaningful.

- Parameters:
`x`

- the first sample`y`

- the second sample`exactPValue`

- 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)- Returns:
- p-value
- Throws:
`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

- The differences Z

**SCaVis 2.1 © jWork.ORG**