statistics- A library of statistical types, data, and functions

Safe HaskellNone




Fast O(NlogN) implementation of Kendall's tau.

This module implementes Kendall's tau form b which allows ties in the data. This is the same formula used by other statistical packages, e.g., R, matlab.

\tau = \frac{n_c - n_d}{\sqrt{(n_0 - n_1)(n_0 - n_2)}}

where n_0 = n(n-1)/2, n_1 = number of pairs tied for the first quantify, n_2 = number of pairs tied for the second quantify, n_c = number of concordant pairs$, n_d = number of discordant pairs.



kendall :: (Ord a, Ord b, Vector v (a, b)) => v (a, b) -> Double Source #

O(nlogn) Compute the Kendall's tau from a vector of paired data. Return NaN when number of pairs <= 1.


  • William R. Knight. (1966) A computer method for calculating Kendall's Tau with ungrouped data. Journal of the American Statistical Association, Vol. 61, No. 314, Part 1, pp. 436-439.