Rust and statistics: do libs exist?

Does anybody know of libraries for common statistical functions, like what stats is for R. The methods are well sourced so I could go and reimplement them, but it feels like someone must have done this already.

The puruspe crate has some functions, but not all distributions can or should be built out of these function primitives.

Here are a few crates to look at:

And a host of other crates listed in

Thankyou for the links. These crates do provide functions for working with samples in statistics, but they lack some features I need. I basically want the probability density function, culmulative distribution function, and quantile function (inverse of cdf) for various distributions. The closest I got was statsrs, which seems to have pdf and cdf, but not qantile functions. Anyway I solved the problem for myself by re-implementing the R stats module in rust (or at least the bits I needed). It's at

The R routines (written in C) handle a lot of edge cases, aim to propagate infinity and NaN correctly, and use a multitude of techniques to stay accurate across the whole domain. They are well worth a look if anyone has an interest.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.