Function spearmanCorTest

Tests the hypothesis that the Spearman correlation between two ranges is different from some 0. Alternatives are Alt.less (spearmanCor(range1, range2) < 0), Alt.greater (spearmanCor(range1, range2) > 0) and Alt.twoSided (spearmanCor(range1, range2) != 0).

TestRes spearmanCorTest(T, U) (
  T range1,
  U range2,
  Alt alt = Alt.twoSided
)
if (isInputRange!T && isInputRange!U && is(typeof(range1.front < range1.front) == bool) && is(typeof(range2.front < range2.front) == bool));

Returns

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

Bugs

Exact P-value computation not yet implemented. Uses asymptotic approximation only. This is good enough for most practical purposes given reasonably large N, but is not perfectly accurate. Not valid for data with very large amounts of ties.