MannWhitneyWilcoxonTest Class |
Namespace: Accord.Statistics.Testing
[SerializableAttribute] public class MannWhitneyWilcoxonTest : HypothesisTest<MannWhitneyDistribution>
The MannWhitneyWilcoxonTest type exposes the following members.
Name | Description | |
---|---|---|
MannWhitneyWilcoxonTest |
Tests whether two samples comes from the
same distribution without assuming normality.
|
Name | Description | |
---|---|---|
CriticalValue |
Gets the critical value for the current significance level.
(Inherited from HypothesisTestTDistribution.) | |
HasTies |
Gets a value indicating whether the provided samples have tied ranks.
| |
Hypothesis |
Gets the alternative hypothesis under test. If the test is
Significant, the null hypothesis can be rejected
in favor of this alternative hypothesis.
| |
IsExact |
Gets whether we are using a exact test.
| |
NumberOfSamples1 |
Gets the number of samples in the first sample.
| |
NumberOfSamples2 |
Gets the number of samples in the second sample.
| |
PValue |
Gets the P-value associated with this test.
(Inherited from HypothesisTestTDistribution.) | |
Rank1 |
Gets the rank statistics for the first sample.
| |
Rank2 |
Gets the rank statistics for the second sample.
| |
RankSum1 |
Gets the sum of ranks for the first sample. Often known as Ta.
| |
RankSum2 |
Gets the sum of ranks for the second sample. Often known as Tb.
| |
Significant |
Gets whether the null hypothesis should be rejected.
(Inherited from HypothesisTestTDistribution.) | |
Size |
Gets the significance level for the
test. Default value is 0.05 (5%).
(Inherited from HypothesisTestTDistribution.) | |
Statistic |
Gets the test statistic.
(Inherited from HypothesisTestTDistribution.) | |
Statistic1 |
Gets the difference between the expected value for
the observed value of RankSum1 and its
expected value under the null hypothesis. Often known as U_a.
| |
Statistic2 |
Gets the difference between the expected value for
the observed value of RankSum2 and its
expected value under the null hypothesis. Often known as U_b.
| |
StatisticDistribution |
Gets the distribution associated
with the test statistic.
(Inherited from HypothesisTestTDistribution.) | |
Tail |
Gets the test type.
(Inherited from HypothesisTestTDistribution.) |
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
OnSizeChanged |
Called whenever the test significance level changes.
(Inherited from HypothesisTestTDistribution.) | |
PValueToStatistic |
Converts a given p-value to a test statistic.
(Overrides HypothesisTestTDistributionPValueToStatistic(Double).) | |
StatisticToPValue |
Converts a given test statistic to a p-value.
(Overrides HypothesisTestTDistributionStatisticToPValue(Double).) | |
ToString |
Converts the numeric P-Value of this test to its equivalent string representation.
(Inherited from HypothesisTestTDistribution.) | |
ToString(String, IFormatProvider) |
Converts the numeric P-Value of this test to its equivalent string representation.
(Inherited from HypothesisTestTDistribution.) |
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |
ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
The Mann–Whitney U test (also called the Mann–Whitney–Wilcoxon (MWW), Wilcoxon rank-sum test, or Wilcoxon–Mann–Whitney test) is a non-parametric test of the null hypothesis that two populations are the same against an alternative hypothesis, especially that a particular population tends to have larger values than the other.
It has greater efficiency than the t-test on non-normal distributions, such as a mixture of normal distributions, and it is nearly as efficient as the t-test on normal distributions.
The following example comes from Richard Lowry's page at http://vassarstats.net/textbook/ch11a.html. As stated by Richard, this example deals with persons seeking treatment by claustrophobia. Those persons are randomly divided into two groups, and each group receive a different treatment for the disorder.
The hypothesis would be that treatment A would more effective than B. To check this hypothesis, we can use Mann-Whitney's Test to compare the medians of both groups.
// Claustrophobia test scores for people treated with treatment A double[] sample1 = { 4.6, 4.7, 4.9, 5.1, 5.2, 5.5, 5.8, 6.1, 6.5, 6.5, 7.2 }; // Claustrophobia test scores for people treated with treatment B double[] sample2 = { 5.2, 5.3, 5.4, 5.6, 6.2, 6.3, 6.8, 7.7, 8.0, 8.1 }; // Create a new Mann-Whitney-Wilcoxon's test to compare the two samples MannWhitneyWilcoxonTest test = new MannWhitneyWilcoxonTest(sample1, sample2, TwoSampleHypothesis.FirstValueIsSmallerThanSecond); double sum1 = test.RankSum1; // 96.5 double sum2 = test.RankSum2; // 134.5 double statistic1 = test.Statistic1; // 79.5 double statistic2 = test.Statistic2; // 30.5 double pvalue = test.PValue; // 0.043834132843420748 // Check if the test was significant bool significant = test.Significant; // true