wilcoxonSignedRank - multiple declarations

Function wilcoxonSignedRank

Computes a test statistic and P-value for a Wilcoxon signed rank test against the given alternative. Alt.less means that elements of before are stochastically less than corresponding elements of after. Alt.greater means elements of before are stochastically greater than corresponding elements of after. Alt.twoSided means there is a significant difference in either direction.

TestRes wilcoxonSignedRank(T, U) (
  T before,
  U after,
  Alt alt = Alt.twoSided,
  uint exactThresh = 50
)
if (doubleInput!T && doubleInput!U && is(typeof(before.front - after.front) : double));

exactThresh is the threshold value of before.length at which this function switches from exact to approximate computation of the p-value. Do not set exactThresh to more than 200, as the exact calculation is both very slow and not numerically stable past this point, and the asymptotic calculation is very good for N this large. To disable exact calculation entirely, set exactThresh to 0.

Notes

Exact p-value computation is never used when ties are present, because it is not computationally feasible.

The input ranges for this function must define a length and must be forward ranges.

Returns

A TestRes of the W statistic and the p-value against the given alternative.

References

http://en.wikipedia.org/wiki/Wilcoxon_signed-rank_test

StackOverflow Question 376003 http://stackoverflow.com/questions/376003

Handbook of Parametric and nonparametric statistical procedures. David Sheskin. Third Edition. (2004) CRC Press. Pg. 616.

Function wilcoxonSignedRank

Same as the overload, but allows testing whether a range is stochastically less than or greater than a fixed value mu rather than paired elements of a second range.

TestRes wilcoxonSignedRank(T) (
  T data,
  double mu,
  Alt alt = Alt.twoSided,
  uint exactThresh = 50
)
if (doubleInput!T && is(typeof(data.front - mu) : double));