BUG: Overflow in 'new' implementation of scipy.stats.kendalltau #18139
Labels
defect
A clear bug or issue that prevents SciPy from being installed or used as expected
scipy.stats
Milestone
Describe your issue.
I have noticed an overflow in scipy.stats.kendalltau with the standard parameters in scipy 1.10.0, when using it to calculate in some cases when the samples given are sufficiently large.
Interestingly enough, using an older implementation of scipy.stats.kendalltau from 0.15.1, this overflow does not occur. The older implementation is different from the newer one, which employs an approximation by default for large samples, and changed a couple of versions ago. The parameter method="exact" does not work when there are ties as in the example below.
Reproducing Code Example
The outputs for scipy 1.10.0 and scipy 0.15.1 are:
results statistic
scipy 1.10.0: 0.0011816493905730343
scipy 0.15.1: 0.0011816493905730343
results pvalue
scipy 1.10.0: 0.4879408388218892
scipy 0.15.1: 0.427971540028532
The statistics agree to machine precision even with the overflow, but the pvalue's do not, but that is okay as scipy 1.10.0 employs an approximate algorithm to calculate the p-value. I think this might point towards that the problem is in the p-value calculation.
Error message
SciPy/NumPy/Python version and system information
The text was updated successfully, but these errors were encountered: