Function kendallCorTest

Tests the hypothesis that the Kendall Tau-b between two ranges is different from 0. Alternatives are Alt.less (kendallCor(range1, range2) < 0), Alt.greater (kendallCor(range1, range2) > 0) and Alt.twoSided (kendallCor(range1, range2) != 0).

TestRes kendallCorTest(T, U) (
  T range1,
  U range2,
  Alt alt = Alt.twoSided,
  uint exactThresh = 50
)
if (isInputRange!T && isInputRange!U);

exactThresh controls the maximum length of the range for which exact P-value computation is used. The default is 50. Exact calculation is never used when ties are present because it is not computationally feasible. Do not set this higher than 100, as it will be very slow and the asymptotic approximation is pretty good at even a fraction of this size.

Note

As an optimization, when a range is a SortedRange with predicate "a < b", it is assumed already sorted and not sorted a second time by this function. This is useful when applying this function multiple times with one of the arguments the same every time.

Returns

A TestRes containing the Kendall correlation coefficient and the P-value for the given alternative.

References

StackOverflow Question 948341 (http://stackoverflow.com/questions/948341)

The Variance of Tau When Both Rankings Contain Ties. M.G. Kendall. Biometrika, Vol 34, No. 3/4 (Dec., 1947), pp. 297-298