Computes the unconditional Kendall's tau

kendall(x, y = NULL)

Arguments

x

a numeric vector.

y

a numeric vector with compatible length to x.

Value

The output is a numeric value for the unconditional Kendall's tau.

Details

This function computes the unconditional Kendall's tau (the Kendall rank correlation coefficient) for two variables. The returned value is equivalent to that from cor with method = "kendall", but kendall is implemented in C.

References

Kendall, M. G. (1938), A new measure of rank correlation, Biometrika, 81--93.

See also

Examples

library(MASS) set.seed(1) dat <- mvrnorm(5000, c(0, 0), matrix(c(1, .5, .5, 1), 2)) ## True kendall's tau is 2 * asin(.5) / pi system.time(print(kendall(dat)))
#> [1] 0.3486412
#> user system elapsed #> 0.077 0.000 0.077
system.time(print(cor(dat, method = "kendall")))
#> [,1] [,2] #> [1,] 1.0000000 0.3486412 #> [2,] 0.3486412 1.0000000
#> user system elapsed #> 0.779 0.000 0.780