Skip to content

Commit

Permalink
TST: stats: Added a regression test for stats.wilcoxon. Closes scipyg…
Browse files Browse the repository at this point in the history
  • Loading branch information
WarrenWeckesser committed Aug 23, 2013
1 parent ab6b69e commit c7988d1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions scipy/stats/tests/test_morestats.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,5 +533,25 @@ def test_accuracy_wilcoxon():
assert_allclose(p, 0.7240817, rtol=1e-6)


def test_wilcoxon_tie():
# Regression test for gh-2391.
# Corresponding R code is:
# > result = wilcox.test(rep(0.1, 10), exact=FALSE, correct=FALSE)
# > result$p.value
# [1] 0.001565402
# > result = wilcox.test(rep(0.1, 10), exact=FALSE, correct=TRUE)
# > result$p.value
# [1] 0.001904195
stat, p = stats.wilcoxon([0.1] * 10)
expected_p = 0.001565402
assert_equal(stat, 0)
assert_allclose(p, expected_p, rtol=1e-6)

stat, p = stats.wilcoxon([0.1] * 10, correction=True)
expected_p = 0.001904195
assert_equal(stat, 0)
assert_allclose(p, expected_p, rtol=1e-6)


if __name__ == "__main__":
run_module_suite()

0 comments on commit c7988d1

Please sign in to comment.