[Scipy-tickets] [SciPy] #1690: scipy.stats.kendalltau: division by zero error
SciPy Trac
scipy-tickets@scipy....
Sun Jul 15 15:43:13 CDT 2012
#1690: scipy.stats.kendalltau: division by zero error
-------------------------+--------------------------------------------------
Reporter: marek | Owner: somebody
Type: defect | Status: needs_decision
Priority: normal | Milestone: Unscheduled
Component: scipy.stats | Version: 0.10.0
Keywords: |
-------------------------+--------------------------------------------------
Changes (by rgommers):
* cc: josefpktd (added)
* status: new => needs_decision
Comment:
I think changing "and" to "or" is fine. The p-value that should also be
returned should probably also be one. Checked what R is giving in this
situation:
{{{
> A <- c(1, 2)
> B <- c(1, 1)
> library(Kendall)
> summary(Kendall(A, B))
Error in Kendall(A, B) : length(x)<3
> A <- c(1,2,3,4)
> B <- c(1,1,1,1)
> summary(Kendall(A, B))
WARNING: Error exit, tauk2. IFAULT = 12
Score = 0 , Var(Score) = 0
denominator = 0
tau = 1, 2-sided pvalue =1
> cor.test(A, B, method="kendall")
Kendall's rank correlation tau
data: A and B
T = NA, p-value = NA
alternative hypothesis: true tau is not equal to 0
sample estimates:
tau
NA
Warning message:
In cor(x, y, method = "kendall") : the standard deviation is zero
}}}
So two ways of computing that don't agree. A warning in both cases. Also a
warning for <3 samples, not sure if we want to do that. Probably not.
So, always return (1, 1) when only one unique value in one of the inputs?
--
Ticket URL: <http://projects.scipy.org/scipy/ticket/1690#comment:1>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.
More information about the Scipy-tickets
mailing list