public class KendallTau extends CorrelationIndex
Note that in the literature the 1945 definition is often called τ_{b}, and τ is reserved for the original coefficient (“A new measure of rank correlation”, Biometrika 30:81−93, 1938). But this distinction is pointless, as the 1938 paper defines τ only for rankings with no ties, and the generalisation in the 1945 paper reduces exactly to the original definition if there are no ties.
Given two scores vectors for a list of items,
this class provides a method to compute efficiently Kendall's τ
using an ExchangeCounter
.
This class is a singleton: methods must be invoked on INSTANCE
.
Additional methods inherited from CorrelationIndex
make it possible to
compute directly the score bewteen two files, or to bound the number of significant digits.
More precisely, given r_{i} and s_{i} (i = 0, 1, …, n − 1), we say that a pair (i, j), i<j, is
Let C, D, T_{r}, T_{s}, J be the number of concordant pairs, discordant pairs, rties, sties and joint ties, respectively, and N = n(n − 1)/2. Of course C+D+T_{r}+T_{s} − J = N. Kendall's τ is now
τ = (C − D) / [(N − T_{r})(N − T_{s})]^{1/2}
A main method is provided for commandline usage.
Modifier and Type  Field and Description 

static KendallTau 
INSTANCE
The singleton instance of this class.

Modifier and Type  Method and Description 

double 
compute(double[] v0,
double[] v1)
Computes Kendall's τ between two score vectors.

static void 
main(java.lang.String[] arg) 
compute, compute, compute, compute, computeDoubles, computeDoubles, computeDoubles, computeDoubles, computeFloats, computeFloats, computeFloats, computeFloats, computeInts, computeInts, computeLongs, computeLongs, loadAsDoubles, parseInputTypes
public static final KendallTau INSTANCE
public double compute(double[] v0, double[] v1)
Note that this method must be called with some care. More precisely, the two
arguments should be built onthefly in the method call, and not stored in variables,
as the first argument array will be null
'd during the execution of this method
to free some memory: if the array is referenced elsewhere the garbage collector will not
be able to collect it.
compute
in class CorrelationIndex
v0
 the first score vector.v1
 the second score vector.public static void main(java.lang.String[] arg) throws java.lang.NumberFormatException, java.io.IOException, JSAPException
java.lang.NumberFormatException
java.io.IOException
JSAPException