31

I'd like to be able to get averages, medians, percentiles, etc. I've been looking all over and can't find anything like it. I realize that Ruby isn't used very much in the scientific world, but there has to exist at least a very basic library in Ruby that does math, right?

3

3 Answers 3

11

How about ruby narray?

http://narray.rubyforge.org/

If you look at the methods, there is a section on statistics that covers your use cases:

http://narray.rubyforge.org/SPEC.en

You might also want to look at the ruby bindings to the GSL:

http://ruby-gsl.sourceforge.net/

1
  • A new version of NArray has been released. The link is old.
    – kojix2
    Apr 25, 2019 at 5:45
9

SciRuby is working on this. We're actually working on NMatrix as a replacement for NArray. The most relevant library for you, however, would likely be Statsample.

And, as mentioned by JoshAdel, Ruby/GSL is a pretty useful gem. We have a fork of it in SciRuby's github account which supports NMatrix instead of NArray.

5

Unfortunately, the development of NMatrix is not active in 2019. On the other hand, NArray has improved performance and continues to release new versions.

On benchmarking, NArray is much faster than NMatrix.

I strongly recommend NArray.

https://github.com/ruby-numo/numo-narray

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.