WilcoxonDistribution Class 
Namespace: Accord.Statistics.Distributions.Univariate
[SerializableAttribute] public class WilcoxonDistribution : UnivariateContinuousDistribution
The WilcoxonDistribution type exposes the following members.
Name  Description  

WilcoxonDistribution(Int32) 
Creates a new Wilcoxon's W+ distribution.
 
WilcoxonDistribution(Double, NullableBoolean) 
Creates a new Wilcoxon's W+ distribution.

Name  Description  

Correction 
Gets or sets the continuity correction
to be applied when using the Normal approximation to this distribution.
 
Entropy 
Gets the entropy for this distribution.
(Overrides UnivariateContinuousDistributionEntropy.)  
Exact 
Gets whether this distribution computes the exact probabilities
(by searching all possible sign combinations) or gives fast
approximations.
 
Mean 
Gets the mean for this distribution.
(Overrides UnivariateContinuousDistributionMean.)  
Median 
Gets the median for this distribution.
(Inherited from UnivariateContinuousDistribution.)  
Mode 
Gets the mode for this distribution.
(Overrides UnivariateContinuousDistributionMode.)  
NumberOfSamples 
Gets the number of effective samples.
 
Quartiles 
Gets the Quartiles for this distribution.
(Inherited from UnivariateContinuousDistribution.)  
StandardDeviation 
Gets the Standard Deviation (the square root of
the variance) for the current distribution.
(Inherited from UnivariateContinuousDistribution.)  
Support 
Gets the support interval for this distribution.
(Overrides UnivariateContinuousDistributionSupport.)  
Table 
Gets the statistic values for all possible combinations
of ranks. This is used to compute the exact distribution.
 
Variance 
Gets the variance for this distribution.
(Overrides UnivariateContinuousDistributionVariance.) 
Name  Description  

Clone 
Creates a new object that is a copy of the current instance.
(Overrides DistributionBaseClone.)  
ComplementaryDistributionFunction 
Gets the complementary cumulative distribution function
(ccdf) for this distribution evaluated at point x.
This function is also known as the Survival function.
(Inherited from UnivariateContinuousDistribution.)  
CumulativeHazardFunction 
Gets the cumulative hazard function for this
distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)  
DistributionFunction(Double) 
Gets the cumulative distribution function (cdf) for
this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)  
DistributionFunction(Double, Double) 
Gets the cumulative distribution function (cdf) for this
distribution in the semiclosed interval (a; b] given as
P(a < X ≤ b).
(Inherited from UnivariateContinuousDistribution.)  
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.)  
Fit(Double) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Fit(Double, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Fit(Double, Double) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Fit(Double, Int32) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Fit(Double, Double, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Fit(Double, Int32, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Generate 
Generates a random observation from the current distribution.
(Inherited from UnivariateContinuousDistribution.)  
Generate(Int32) 
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.)  
Generate(Random) 
Generates a random observation from the current distribution.
(Inherited from UnivariateContinuousDistribution.)  
Generate(Int32, Double) 
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.)  
Generate(Int32, Random) 
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.)  
Generate(Int32, Double, Random) 
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.)  
GetHashCode  Serves as the default hash function. (Inherited from Object.)  
GetRange 
Gets the distribution range within a given percentile.
(Inherited from UnivariateContinuousDistribution.)  
GetType  Gets the Type of the current instance. (Inherited from Object.)  
HazardFunction 
Gets the hazard function, also known as the failure rate or
the conditional failure density function for this distribution
evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)  
InnerComplementaryDistributionFunction 
Gets the complementary cumulative distribution function
(ccdf) for this distribution evaluated at point x.
This function is also known as the Survival function.
(Overrides UnivariateContinuousDistributionInnerComplementaryDistributionFunction(Double).)  
InnerDistributionFunction 
Gets the cumulative distribution function (cdf) for
this distribution evaluated at point k.
(Overrides UnivariateContinuousDistributionInnerDistributionFunction(Double).)  
InnerInverseDistributionFunction 
Gets the inverse of the cumulative distribution function (icdf) for
this distribution evaluated at probability p. This function
is also known as the Quantile function.
(Overrides UnivariateContinuousDistributionInnerInverseDistributionFunction(Double).)  
InnerLogProbabilityDensityFunction 
Gets the logprobability density function (pdf) for
this distribution evaluated at point w.
(Overrides UnivariateContinuousDistributionInnerLogProbabilityDensityFunction(Double).)  
InnerProbabilityDensityFunction 
Gets the probability density function (pdf) for
this distribution evaluated at point w.
(Overrides UnivariateContinuousDistributionInnerProbabilityDensityFunction(Double).)  
InverseDistributionFunction 
Gets the inverse of the cumulative distribution function (icdf) for
this distribution evaluated at probability p. This function
is also known as the Quantile function.
(Inherited from UnivariateContinuousDistribution.)  
LogCumulativeHazardFunction 
Gets the log of the cumulative hazard function for this
distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)  
LogProbabilityDensityFunction 
Gets the logprobability density function (pdf) for
this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)  
MemberwiseClone  Creates a shallow copy of the current Object. (Inherited from Object.)  
ProbabilityDensityFunction 
Gets the probability density function (pdf) for
this distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)  
QuantileDensityFunction 
Gets the first derivative of the
inverse distribution function (icdf) for this distribution evaluated
at probability p.
(Inherited from UnivariateContinuousDistribution.)  
ToString 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(IFormatProvider) 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(String) 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(String, IFormatProvider) 
Returns a String that represents this instance.
(Overrides DistributionBaseToString(String, IFormatProvider).)  
WMinimum 
Computes the Wilcoxon's W statistic (equivalent to
MannWhitney U when used in twosample tests).
 
WNegative 
Computes the Wilcoxon's W statistic.
 
WPositive 
Computes the Wilcoxon's W+ statistic.

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.)  
ToT 
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.) 
This is the distribution for the positive side statistic W+ of the Wilcoxon test. Some textbooks (and statistical packages) use alternate definitions for W, which should be compared with the appropriate statistic tables or alternate distributions.
The Wilcoxon signedrank test is a nonparametric statistical hypothesis test used when comparing two related samples, matched samples, or repeated measurements on a single sample to assess whether their population mean ranks differ (i.e. it is a paired difference test). It can be used as an alternative to the paired Student's ttest, ttest for matched pairs, or the ttest for dependent samples when the population cannot be assumed to be normally distributed.
References:
// Compute some rank statistics (see other examples below) double[] ranks = { 1, 2, 3, 4, 5.5, 5.5, 7, 8, 9, 10, 11, 12 }; // Create a new Wilcoxon's W distribution WilcoxonDistribution W = new WilcoxonDistribution(ranks); // Common measures double mean = W.Mean; // 39.0 double median = W.Median; // 38.5 double var = W.Variance; // 162.5 // Probability density functions double pdf = W.ProbabilityDensityFunction(w: 42); // 0.38418508862319295 double lpdf = W.LogProbabilityDensityFunction(w: 42); // 0.38418508862319295 // Cumulative distribution functions double cdf = W.DistributionFunction(w: 42); // 0.60817384423279575 double ccdf = W.ComplementaryDistributionFunction(x: 42); // 0.39182615576720425 // Quantile function double icdf = W.InverseDistributionFunction(p: cdf); // 42 // Hazard (failure rate) functions double hf = W.HazardFunction(x: 42); // 0.98049883339449373 double chf = W.CumulativeHazardFunction(x: 42); // 0.936937017743799 // String representation string str = W.ToString(); // "W+(x; R)"
The following example shows how to compute the W+ statistic given a sample. The Statsstics is given as the sum of all positive signed ranks in a sample.
// Suppose we have computed a vector of differences between // samples and an hypothesized value (as in Wilcoxon's test). double[] differences = ... // differences between samples and an hypothesized median // Compute the ranks of the absolute differences and their sign double[] ranks = Measures.Rank(differences.Abs()); int[] signs = Accord.Math.Matrix.Sign(differences).ToInt32(); // Compute the W+ statistics from the signed ranks double W = WilcoxonDistribution.WPositive(Signs, ranks);