[Repo Assist] feat: add Mann-Whitney U test (Wilcoxon rank-sum) for two independent samples#376
Draft
github-actions[bot] wants to merge 2 commits intodeveloperfrom
Draft
Conversation
… samples Implements MannWhitneyTest.create in Testing/MannWhitney.fs: - Computes U1 and U2 statistics via rank sums - Normal approximation with optional continuity correction - Standard variance tie correction (all 3 counts handled) - Returns MannWhitneyTestStatistics with U1, U2, Statistic (z), PValueLeft, PValueRight, PValue - 8 new tests covering clear separation, moderate overlap, and tied data - All 1201 tests pass This complements the existing WilcoxonTest (signed-rank, paired samples) with the rank-sum test for two independent samples. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## developer #376 +/- ##
=============================================
+ Coverage 47.61% 47.92% +0.30%
=============================================
Files 152 136 -16
Lines 16765 12967 -3798
Branches 2253 1717 -536
=============================================
- Hits 7983 6214 -1769
+ Misses 8097 6231 -1866
+ Partials 685 522 -163 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated pull request from Repo Assist, an AI assistant.
Summary
Adds
MannWhitneyTest.create— the Mann-Whitney U test (also known as the Wilcoxon rank-sum test) for comparing two independent samples. This complements the existingWilcoxonTestwhich handles paired (signed-rank) samples.This addresses requests in issues #117 and #213 for a two-sample nonparametric test.
What's new
New file:
src/FSharp.Stats/Testing/MannWhitney.fsMannWhitneyTestStatisticsrecord:U1U2U1 + U2 = n1×n2StatisticPValueLeftPValueRightPValueImplementation details
Rank.RankAverage()(average ranks for ties)correct=TRUEwilcox.test(..., exact=FALSE)Test Status
✅ All 1201 tests pass (8 new tests added in
Testing.fs):U statistics - clear separationU1 + U2 = n1*n2p-values - clear separation, no ccp-values - clear separation, with ccU statistics - moderate overlapp-value not significant - moderate overlapU statistics with tiesp-values with tiesTrade-offs / limitations
n1andn2in the result record (can be inferred from input lengths).