22 releases (breaking)

0.17.1 Jun 8, 2024
0.16.1 Jun 2, 2024
0.16.0 Aug 29, 2022
0.15.0 Jun 30, 2021
0.3.2 Nov 19, 2016

#4 in Math

Download history 33140/week @ 2024-08-02 36493/week @ 2024-08-09 33558/week @ 2024-08-16 35672/week @ 2024-08-23 35222/week @ 2024-08-30 32284/week @ 2024-09-06 34718/week @ 2024-09-13 42553/week @ 2024-09-20 42752/week @ 2024-09-27 43437/week @ 2024-10-04 44424/week @ 2024-10-11 41795/week @ 2024-10-18 39551/week @ 2024-10-25 40293/week @ 2024-11-01 36793/week @ 2024-11-08 37542/week @ 2024-11-15

162,454 downloads per month
Used in 684 crates (163 directly)

MIT license

700KB
13K SLoC

statrs

tests MIT licensed Crate docs.rs

Statrs provides a host of statistical utilities for Rust scientific computing.

Included are a number of common distributions that can be sampled (i.e. Normal, Exponential, Student's T, Gamma, Uniform, etc.) plus common statistical functions like the gamma function, beta function, and error function.

This library began as port of the statistical capabilities in the C# Math.NET library. All unit tests in the library borrowed from Math.NET when possible and filled-in when not. Planned for future releases are continued implementations of distributions as well as porting over more statistical utilities.

Please check out the documentation here.

Usage

Add the most recent release to your Cargo.toml

[dependencies]
statrs = "*" # replace * by the latest version of the crate.

For examples, view the docs.

Contributing

Thanks for your help to improve the project! No contribution is too small and all contributions are valued.

Suggestions if you don't know where to start,

  • documentation is a great place to start, as you'll be able to identify the value of existing documentation better than its authors.
  • tests are valuable in demonstrating correct behavior, you can review test coverage on the CodeCov Report*, not live until #229 merged.
  • check out some of the issues marked help wanted.
  • look at what's not included from Math.NET's Distributions, Statistics, or related.

How to contribute

Clone the repo:

git clone https://github.com/statrs-dev/statrs

Create a feature branch:

git checkout -b <feature_branch> master

Write your code and docs, then ensure it is formatted:

The below sample modify in-place, use --check flag to view diff without making file changes. Not using fmt from +nightly may result in some warnings and different formatting. Our CI will fmt, but less chores in commit history are appreciated.

cargo +nightly fmt

After commiting your code:

git push -u origin <feature_branch>

Then submit a PR, preferably referencing the relevant issue, if it exists.

Commit messages

Please be explicit and and purposeful with commit messages. Conventional Commits encouraged.

Bad

Modify test code

Good

test: Update statrs::distribution::Normal test_cdf

Communication Expectations

Please allow at least one week before pinging issues/pr's.

Dependencies

~5.5MB
~109K SLoC