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

Safe HaskellNone
LanguageHaskell98

Statistics.Correlation.Kendall

Contents

Description

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.

Synopsis

Documentation

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

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

References

  • 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. http://www.jstor.org/pss/2282833