fslaborg / fslaborg/FSharp.Stats
Add Wilcoxon Distribution
- Dominant language
- F#
- Stars
- 227
- Forks
- 58
- Avg merge
- 55m
- Merged PRs (30d)
- 1
Description
### Description
>The signed rank test currently is only an approximation for large values (see https://github.com/fslaborg/FSharp.Stats/pull/182#discussion_r908169551)
There is a valid wilcoxon distribution that is quite expensive to calculate. Nevertheless it is required to calculate exact u test results, and should be implemented:
Citation from #213
To perform a valid u test it is required to implement the Wilcoxon distribution. Is should be added as individual source file within `Distributions/Continuous`. You can copy the [Distributions/Continuous/Normal.fs](https://github.com/fslaborg/FSharp.Stats/blob/developer/src/FSharp.Stats/Distributions/Continuous/Normal.fs) and replace all fields with its corresponding entries for the Wilcoxon distribution.
### References
- [1] [Rwilcox](https://github.com/SurajGupta/r-source/blob/master/src/nmath/wilcox.c)
- [2] [R vigenette](https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/Wilcoxon)
- [3] [analytica wilcox](https://wiki.analytica.com/index.php?title=Wilcoxon_Distribution&title=Wilcoxon_Distribution#Wilcoxon.28m.2C_n.2C_exact.29)
- [4] [original publication](https://projecteuclid.org/journals/annals-of-mathematical-statistics/volume-18/issue-1/On-a-Test-of-Whether-one-of-Two-Random-Variables/10.1214/aoms/1177730491.full)
### Pointers
- suggested workflow:
- check out other distribution implementations and the original publication
- copy a existing source file (e.g. Normal.fs), rename it to Wilcoxon.fs and replace all members.
- this may be harder as you would imagine, but even if not all members are implemented, it would help us bringing FSharp.Stats a step further
- optional: add unit tests
Hints (click to expand if you need additional pointers)
A final PR should contain the source file as well as unit tests to verify the correct results of the calculations. But even if some functions are missing, you can file a PR and mention what has to be added and where the problems are. For appropriate unit tests you can check out [exponential distribution unit tests](https://github.com/fslaborg/FSharp.Stats/blob/8fb5d6dd07ff213a4e91b618fb2e654bc6147985/tests/FSharp.Stats.Tests/DistributionsContinuous.fs#L1064).
- To be able to contribute to this library you'll need
- an GitHub account
- an IDE like Visual Studio Community or Visual Studio Code
- [dotnet 6 sdk](https://dotnet.microsoft.com/en-us/download)
- to build the binaries yourself follow the [instructions](https://fslab.org/FSharp.Stats/#Installation)
- while working on the [FSharp.Stats documentation](https://fslab.org/FSharp.Stats/) (any file within https://github.com/fslaborg/FSharp.Stats/tree/developer/docs) you can navigate to the project folder with a prompt of your choice and use the command `./build watchdocs`
- unit tests can be executed via `./build runtests`
Contributor guide
Assessment
This issue has not been assessed yet.