[R] kendall's w

Jim Lemon jim at bitwrit.com.au
Fri Sep 15 01:56:36 CEST 2006


Bianca Vieru wrote:
> Hi,
> 
> I try to calculate Kendall's W coefficient and I have a bizarre error.
> 
> 
> little.app.mat<-matrix(c(1,3,4,2,6,5,2,4,3,1,5,6,3,2,5,1,5,4),nrow=3,byrow=TRUE)
> print(kendall.w(little.app.mat[-1,]))
>  >>> Kendall's W for ordinal data
>  >>> W = 0.7753623Error in if (is.na(x$p.table)) { : argument is of 
> length zero
> 
> big.app.mat<-matrix(c(1,3,4,2,6,5,2,4,3,1,5,6,3,2,5,1,5,42,3,5,3,6,7,9,9,8,7),nrow=3,byrow=TRUE)
> print(kendall.w(big.app.mat[-1,]))
>  >>>Kendall's W for ordinal data
>  >>>W = 0.4568966  p(X2[8]) = 0.5035488
> 
> Why is that working for the big matrix and not for the little one?
> 
Thanks for finding this and thanks to David Barron for the correct 
answer - I'll insert a check for out of range matrices like this and 
submit a new version.

Jim



More information about the R-help mailing list