I assume you are using the function in the concord package. This seems to
happen because there is a different way of calculating the p-value depending
on whether or not there are more than 7 cases. If there are 7 or less, the
function doesn't work unless there are more than two rows. Here is the
relevant code fragment:
if (datadim[2] > 7) {
p.table <- NA
x2df <- datadim[2] - 1
p.chisq <- pchisq(datadim[1] * (datadim[2] - 1) * W,
x2df, lower.tail = FALSE)
}
else {
p.table <- ifelse(W > Wcrit01[datadim[2] - 2, datadim[1] -
2], "<0.01", ifelse(W > Wcrit05[datadim[2] - 2,
datadim[1] -
2], "<0.05", "> 0.05"))
x2df <- NA
p.chisq <- NA
}
On 13/09/06, Bianca Vieru <bianca.vieru@free.fr >
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,
> Bianca
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
================================David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP
--
================================David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP
[[alternative HTML version deleted]]