Package dev.nm.stat.test.rank.wilcoxon
Class WilcoxonSignedRank
- java.lang.Object
-
- dev.nm.stat.test.HypothesisTest
-
- dev.nm.stat.test.rank.wilcoxon.WilcoxonSignedRank
-
public class WilcoxonSignedRank extends HypothesisTest
The Wilcoxon signed rank test tests, for the one-sample case, the median of the distribution against a hypothetical median, and for the two-sample case, the equality of medians of groups. Unlike the Student's t-test, the Wilcoxon signed rank test does not assume any distribution of the population. The R equivalent function iswilcox.test
.- See Also:
- "Gibbons and Chakraborti, Nonparameric statistical inference (2003), Chapter 5.7, p.197."
- Wikipedia: Wilcoxon signed-rank test
-
-
Constructor Summary
Constructors Constructor Description WilcoxonSignedRank(double[] sample)
Perform the Wilcoxon Signed Rank test to test for the equality of medians.WilcoxonSignedRank(double[] sample1, double[] sample2)
Perform the Wilcoxon Signed Rank test to test for the equality of medians.WilcoxonSignedRank(double[] sample1, double[] sample2, double mu, boolean isExact)
Perform the Wilcoxon Signed Rank test to test for the equality of medians.WilcoxonSignedRank(double[] sample, int mu)
Perform the Wilcoxon Signed Rank test to test for the equality of medians.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAlternativeHypothesis()
Get the description of the alternative hypothesis.String
getNullHypothesis()
Get a description of the null hypothesis.double
leftOneSidedPvalue()
Get the left, one-sided p-value.double
pValue()
Get the p-value for the test statistics.double
rightOneSidedPvalue()
Get the right, one-sided p-value.double
statistics()
Get the test statistics.-
Methods inherited from class dev.nm.stat.test.HypothesisTest
isNullRejected, nGroups, nObs, oneSidedPvalue
-
-
-
-
Constructor Detail
-
WilcoxonSignedRank
public WilcoxonSignedRank(double[] sample1, double[] sample2, double mu, boolean isExact)
Perform the Wilcoxon Signed Rank test to test for the equality of medians.- Parameters:
sample1
- sample 1sample2
- sample 2mu
- the hypothetical median that the distribution is symmetric aboutisExact
-true
if to use the exact distribution; otherwise, normal approximation is used
-
WilcoxonSignedRank
public WilcoxonSignedRank(double[] sample1, double[] sample2)
Perform the Wilcoxon Signed Rank test to test for the equality of medians.- Parameters:
sample1
- sample 1sample2
- sample 2
-
WilcoxonSignedRank
public WilcoxonSignedRank(double[] sample, int mu)
Perform the Wilcoxon Signed Rank test to test for the equality of medians.- Parameters:
sample
- a samplemu
- the hypothetical median that the distribution is symmetric about
-
WilcoxonSignedRank
public WilcoxonSignedRank(double[] sample)
Perform the Wilcoxon Signed Rank test to test for the equality of medians.- Parameters:
sample
- a sample
-
-
Method Detail
-
getNullHypothesis
public String getNullHypothesis()
Description copied from class:HypothesisTest
Get a description of the null hypothesis.- Specified by:
getNullHypothesis
in classHypothesisTest
- Returns:
- the null hypothesis description
- See Also:
- Wikipedia: Null hypothesis
-
getAlternativeHypothesis
public String getAlternativeHypothesis()
Description copied from class:HypothesisTest
Get the description of the alternative hypothesis.- Specified by:
getAlternativeHypothesis
in classHypothesisTest
- Returns:
- the alternative hypothesis description
- See Also:
- Wikipedia: Alternative hypothesis
-
statistics
public double statistics()
Description copied from class:HypothesisTest
Get the test statistics.- Specified by:
statistics
in classHypothesisTest
- Returns:
- the test statistics
- See Also:
- Wikipedia: Test statistic
-
pValue
public double pValue()
Description copied from class:HypothesisTest
Get the p-value for the test statistics.- Specified by:
pValue
in classHypothesisTest
- Returns:
- the p-value
- See Also:
- Wikipedia: P-value
-
rightOneSidedPvalue
public double rightOneSidedPvalue()
Get the right, one-sided p-value.- Returns:
- the right, one-sided p-value.
-
leftOneSidedPvalue
public double leftOneSidedPvalue()
Get the left, one-sided p-value.- Returns:
- the left, one-sided p-value.
-
-