Kendall (version 1.0)

Kendall: Kendall rank correlation

Description

Computes the Kendall rank correlation and its p-value on a two-sided test of H0: x and y are independent.

Usage

Kendall(x, y)

Arguments

x
first variable, a vector
y
second variable, a vector the same length as x

Value

  • A list with class Kendall is returned with the following components:
  • tauKendall's tau statistic
  • sltwo-sided p-value
  • SKendall Score
  • Ddenominator, tau=S/D
  • varSvariance of S
  • Generic functions print.Kendall and summary.Kendall are provided.

Details

In many applications x and y may be ranks or even ordered categorical variables. In our function x and y should be numeric vectors. Kendall's rank correlation measures the strength of monotonic association between the vectors x and y. In the case of no ties in the x and y variables, Kendall's rank correlation coefficient, tau, may be expressed as $\tau = S/D$ where $$S=\sum_{i

References

Best, D.J. and Gipps, P.G. (1974), Algorithm AS 71: The Upper Tail Probabilities of Kendall's Tau Applied Statistics, Vol. 23, No. 1. (1974), pp. 98-100. Davison, A.C. and Hinkley, D.V. (1997) Bootstrap Methods and Their Application. Cambridge University Press. Kendall, M.G. (1976). Rank Correlation Methods. 4th Ed. Griffin. Hill, I.D. (1973), Algorithm AS 66: The Normal Integral Applied Statistics, Vol. 22, No. 3. (1973), pp. 424-427. Valz, P.D. and Thompson, M.E. (1994), Exact inference for Kendall's S and Spearman's rho. Journal of Computational and Graphical Statistics, 3, 459--472.

See Also

cor, print.Kendall, summary.Kendall, MannKendall,SeasonalMannKendall

Examples

Run this code
#First Example
#From Kendall (1976, p.42-43, Example 3.4)
A<-c(2.5,2.5,2.5,2.5,5,6.5,6.5,10,10,10,10,10,14,14,14,16,17)
B<-c(1,1,1,1,2,1,1,2,1,1,1,1,1,1,2,2,2)
summary(Kendall(A,B))
#Kendall obtains S=34, D=sqrt(116*60), tau=0.41

#Second Example
#From Kendall (1976, p.55, Example 4.3)
x<-c(1.5,1.5,3,4,6,6,6,8,9.5,9.5,11,12)
y<-c(2.5,2.5,7,4.5,1,4.5,6,11.5,11.5,8.5,8.5,10)
summary(Kendall(x,y))
#Kendall obtains S=34 and Var(S)=203.30

Run the code above in your browser using DataLab