[R] Bug in Kendall for n<4?

Stavros Macrakis macrakis at alum.mit.edu
Fri Nov 21 20:44:37 CET 2008

> library(Kendall)
> Kendall(1:3,1:3)
WARNING: Error exit, tauk2. IFAULT =  12          <<<<<<
tau = 1, 2-sided pvalue =1

I believe Kendall tau is well-defined for this case and the reported
value is correct; isn't it a bug to give a warning?  (And if, e.g.,
the pvalue is not well-defined in this case, wouldn't it be better to
return NA or NaN or something?) Also, shouldn't the error code be
given in plain English -- or at least the meaning of "IFAULT = 12"
documented on the help page?

A somewhat less clear case is Kendall(1:2,1:2), which gives the same
error.  Though the usual formula for Kendall tau has a zero in the
denominator in this case, I'd think the correct generalization is 1 if
the two elements are in the same order, and -1 if they are not (the
only possibilities). But perhaps I don't fully understand the
interpretation of this statistic.


More information about the R-help mailing list