Skip to content
Prev 75542 / 398502 Next

R/S-Plus/SAS yield different results for Kendall-tau and Spearman nonparametric regression

Dennis Fisher <fisher at plessthan.com> writes:
(They came across somewhat garbled, but we'll believe you...)

...
Ties are certainly involved in the Spearman case. There are more
accurate expressions for the variance of the test statistic in the
tied case, than the formula that R is using. As you see, the
difference is not exactly huge (at least for a small number of ties),
but it is something that we should get around to fixing.

I assume that there is a similar issue with Kendall's tau. In
addition, S-PLUS appears to modify the actual definition of the test
statistic, which might be a matter of taste. (K's tau relies
on counting concordant and discordant pairs relative to the total
number of pairs, and with ties, some pairs will be undecided. You can
either discard such pairs or count them as zeros. S-PLUS appears to be
doing the latter. A quick test is to notice that  x <- y <- rep(0:1,4)
gives a tau that is less than 1 in S-PLUS but gives 1 in R.)