BivariateKendallTauTest Method |
Namespace: Meta.Numerics.Statistics
public static TestResult KendallTauTest( IReadOnlyList<double> x, IReadOnlyList<double> y )
Exception | Condition |
---|---|
ArgumentNullException | x or y is . |
DimensionMismatchException | x and y do not contain the same number of entries. |
InsufficientDataException | There are fewer than two entries in the sample. |
Kendall's τ is a non-parametric and robust test of association between two variables. It simply measures the number of cases where an increase in one variable is associated with an increase in the other (concordant pairs), compared with the number of cases where an increase in one variable is associated with a decrease in the other (discordant pairs).
Because τ depends only on the sign of the difference and not its magnitude, it is not skewed by outliers exhibiting very large changes, nor by cases where the degree of difference changes over the ranges of the variables. Of course, it may still miss an association whose sign changes over the range of the variables. For example, if data points lie along a semi-circle in the plane, an increase in the first variable is associated with an increase in the second variable along the rising arc and and decrease in the second variable along the falling arc.
Because it examines all pairs of data points, the Kendall test requires O(N2) operations. It is thus impractical for very large data sets. While not quite as robust as the Kendall test, the Spearman test is a good fall-back in such cases.