Learn R Programming

tranSurv (version 1.2.4)

kendall: Kendall's tau

Description

Computes the unconditional Kendall's tau

Usage

kendall(x, y = NULL)

Value

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

A numeric value representing the unconditional Kendall's tau.

Arguments

x

a numeric vector.

y

a numeric vector with compatible length to x.

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

Run this code
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)))
system.time(print(cor(dat, method = "kendall")))

Run the code above in your browser using DataLab