Class WilcoxonSignedRankTest
- Since:
- 1.1
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classResult for the Wilcoxon signed-rank test. -
Method Summary
Modifier and TypeMethodDescriptiondoublestatistic(double[] z) Computes the Wilcoxon signed ranked statistic comparing the differences between sample valuesz = x - ytomu.doublestatistic(double[] x, double[] y) Computes the Wilcoxon signed ranked statistic comparing the differences between two related samples or repeated measurements on a single sample.test(double[] z) Performs a Wilcoxon signed ranked statistic comparing the differences between sample valuesz = x - ytomu.test(double[] x, double[] y) Performs a Wilcoxon signed ranked statistic comparing mean for two related samples or repeated measurements on a single sample.Return an instance with the configured alternative hypothesis.Return an instance with the configured continuity correction.with(PValueMethod v) Return an instance with the configured p-value method.static WilcoxonSignedRankTestReturn an instance using the default options.withMu(double v) Return an instance with the configured expected differencemu.
-
Method Details
-
withDefaults
Return an instance using the default options.- Returns:
- default instance
-
with
Return an instance with the configured alternative hypothesis.- Parameters:
v- Value.- Returns:
- an instance
-
with
Return an instance with the configured p-value method.- Parameters:
v- Value.- Returns:
- an instance
- Throws:
IllegalArgumentException- if the value is not in the allowed options or is null
-
with
Return an instance with the configured continuity correction.If
enabled, adjust the Wilcoxon rank statistic by 0.5 towards the mean value when computing the z-statistic if a normal approximation is used to compute the p-value.- Parameters:
v- Value.- Returns:
- an instance
-
withMu
Return an instance with the configured expected differencemu.- Parameters:
v- Value.- Returns:
- an instance
- Throws:
IllegalArgumentException- if the value is not finite
-
statistic
Computes the Wilcoxon signed ranked statistic comparing the differences between sample valuesz = x - ytomu.This method handles matching samples
z[i] == mu(no difference) by including them in the ranking of samples but excludes them from the test statistic (signed-rank zero procedure).- Parameters:
z- Signed differences between sample values.- Returns:
- Wilcoxon positive-rank sum statistic (W+)
- Throws:
IllegalArgumentException- ifzis zero-length; contains NaN values; or all differences are equal to the expected difference- See Also:
-
statistic
Computes the Wilcoxon signed ranked statistic comparing the differences between two related samples or repeated measurements on a single sample.This method handles matching samples
x[i] - mu == y[i](no difference) by including them in the ranking of samples but excludes them from the test statistic (signed-rank zero procedure).This method is functionally equivalent to creating an array of differences
z = x - yand callingstatistic(z); the implementation may use an optimised method to compute the differences and rank statistic ifmu != 0.- Parameters:
x- First sample values.y- Second sample values.- Returns:
- Wilcoxon positive-rank sum statistic (W+)
- Throws:
IllegalArgumentException- ifxoryare zero-length; are not the same length; contain NaN values; orx[i] == y[i]for all data- See Also:
-
test
Performs a Wilcoxon signed ranked statistic comparing the differences between sample valuesz = x - ytomu.This method handles matching samples
z[i] == mu(no difference) by including them in the ranking of samples but excludes them from the test statistic (signed-rank zero procedure).The test is defined by the
AlternativeHypothesis.- 'two-sided': the distribution of the difference is not symmetric about
mu. - 'greater': the distribution of the difference is stochastically greater than a
distribution symmetric about
mu. - 'less': the distribution of the difference is stochastically less than a distribution
symmetric about
mu.
If the p-value method is auto an exact p-value is computed if the samples contain less than 50 values; otherwise a normal approximation is used.
Computation of the exact p-value is only valid if there are no matching samples
z[i] == muand no tied ranks in the data; otherwise the p-value resorts to the asymptotic Cureton approximation using a tie correction and an optional continuity correction.Note: Computation of the exact p-value requires the sample size
<= 1023. Exact computation requires tabulation of values not exceeding sizen(n+1)/2and computes in Order(n*n/2). Maximum memory usage is approximately 4 MiB.- Parameters:
z- Differences between sample values.- Returns:
- test result
- Throws:
IllegalArgumentException- ifzis zero-length; contains NaN values; or all differences are zero- See Also:
- 'two-sided': the distribution of the difference is not symmetric about
-
test
Performs a Wilcoxon signed ranked statistic comparing mean for two related samples or repeated measurements on a single sample.This method handles matching samples
x[i] - mu == y[i](no difference) by including them in the ranking of samples but excludes them from the test statistic (signed-rank zero procedure).This method is functionally equivalent to creating an array of differences
z = x - yand callingtest(z); the implementation may use an optimised method to compute the differences and rank statistic ifmu != 0.- Parameters:
x- First sample values.y- Second sample values.- Returns:
- test result
- Throws:
IllegalArgumentException- ifxoryare zero-length; are not the same length; contain NaN values; orx[i] - mu == y[i]for all data- See Also:
-