Click or drag to resize
Accord.NET (logo)

MannWhitneyWilcoxonTest Class

Mann-Whitney-Wilcoxon test for unpaired samples.
Inheritance Hierarchy
SystemObject
  Accord.Statistics.TestingHypothesisTestMannWhitneyDistribution
    Accord.Statistics.TestingMannWhitneyWilcoxonTest

Namespace:  Accord.Statistics.Testing
Assembly:  Accord.Statistics (in Accord.Statistics.dll) Version: 3.8.0
Syntax
[SerializableAttribute]
public class MannWhitneyWilcoxonTest : HypothesisTest<MannWhitneyDistribution>
Request Example View Source

The MannWhitneyWilcoxonTest type exposes the following members.

Constructors
  NameDescription
Public methodMannWhitneyWilcoxonTest
Tests whether two samples comes from the same distribution without assuming normality.
Top
Properties
  NameDescription
Public propertyCriticalValue
Gets the critical value for the current significance level.
(Inherited from HypothesisTestTDistribution.)
Public propertyHasTies
Gets a value indicating whether the provided samples have tied ranks.
Public propertyHypothesis
Gets the alternative hypothesis under test. If the test is Significant, the null hypothesis can be rejected in favor of this alternative hypothesis.
Public propertyIsExact
Gets whether we are using a exact test.
Public propertyNumberOfSamples1
Gets the number of samples in the first sample.
Public propertyNumberOfSamples2
Gets the number of samples in the second sample.
Public propertyPValue
Gets the P-value associated with this test.
(Inherited from HypothesisTestTDistribution.)
Public propertyRank1
Gets the rank statistics for the first sample.
Public propertyRank2
Gets the rank statistics for the second sample.
Public propertyRankSum1
Gets the sum of ranks for the first sample. Often known as Ta.
Public propertyRankSum2
Gets the sum of ranks for the second sample. Often known as Tb.
Public propertySignificant
Gets whether the null hypothesis should be rejected.
(Inherited from HypothesisTestTDistribution.)
Public propertySize
Gets the significance level for the test. Default value is 0.05 (5%).
(Inherited from HypothesisTestTDistribution.)
Public propertyStatistic
Gets the test statistic.
(Inherited from HypothesisTestTDistribution.)
Public propertyStatistic1
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.
Public propertyStatistic2
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.
Public propertyStatisticDistribution
Gets the distribution associated with the test statistic.
(Inherited from HypothesisTestTDistribution.)
Public propertyTail
Gets the test type.
(Inherited from HypothesisTestTDistribution.)
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOnSizeChanged
Called whenever the test significance level changes.
(Inherited from HypothesisTestTDistribution.)
Public methodPValueToStatistic
Converts a given p-value to a test statistic.
(Overrides HypothesisTestTDistributionPValueToStatistic(Double).)
Public methodStatisticToPValue
Converts a given test statistic to a p-value.
(Overrides HypothesisTestTDistributionStatisticToPValue(Double).)
Public methodToString
Converts the numeric P-Value of this test to its equivalent string representation.
(Inherited from HypothesisTestTDistribution.)
Public methodToString(String, IFormatProvider)
Converts the numeric P-Value of this test to its equivalent string representation.
(Inherited from HypothesisTestTDistribution.)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(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.)
Public Extension MethodToTOverloaded.
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.)
Top
Remarks

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.

Examples

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
See Also