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.

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.

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

Return Value

Type: TestRes

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.