# Statistics calculations in Ruby

**URL:** <https://www.ruby-forum.com/t/statistics-calculations-in-ruby/177540>\
**Category:** Ruby\
**Created:** [October 20, 2009, 12:45am UTC](https://www.ruby-forum.com/t/statistics-calculations-in-ruby/177540 "2009-10-20T00:45:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thiagobrandam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c4cdca/32.png) [@thiagobrandam](https://www.ruby-forum.com/u/thiagobrandam)\
**Post date:** [October 20, 2009, 12:45am UTC](https://www.ruby-forum.com/t/statistics-calculations-in-ruby/177540/1 "2009-10-20T00:45:00Z")

</div>

Hi all,  
I have to do some statistics calculations (normal distribution, etc)  
in Ruby and I don’t seem to find much of it in the language itself.  
Would be the R statistics package the best solution so far?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![thiagobrandam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c4cdca/32.png) [@thiagobrandam](https://www.ruby-forum.com/u/thiagobrandam)\
**Post date:** [October 20, 2009, 7:06am UTC](https://www.ruby-forum.com/t/statistics-calculations-in-ruby/177540/2 "2009-10-20T07:06:48Z")

</div>

thiagobrandam wrote:

> Hi all,  
> I have to do some statistics calculations (normal distribution, etc)  
> in Ruby and I don’t seem to find much of it in the language itself.

Ruby ‘describes’ itself as a dynamic scripting/programming language. R  
‘describes’ itself as a statistical programming environment.

The ruby community also offers you RSruby which is a bridge between Ruby  
and the R interpreted language see here  
[http://rubyforge.org/projects/rsruby/](http://rubyforge.org/projects/rsruby/). There could be others too.

> Would be the R statistics package the best solution so far?  
> There many statistical programs and packages. It might depend with your  
> knowledge and tasks to choose which one to use. Most statistical  
> algorithms and theories are available in public domain. You can  
> implement them in your programming language of choice or stick with a  
> known package that implements them to avoid reinventing the wheel.

---

<div class="post-metadata">

**Author:** ![thiagobrandam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c4cdca/32.png) [@thiagobrandam](https://www.ruby-forum.com/u/thiagobrandam)\
**Post date:** [October 20, 2009, 8:04am UTC](https://www.ruby-forum.com/t/statistics-calculations-in-ruby/177540/3 "2009-10-20T08:04:06Z")

</div>

thiagobrandam wrote:

> Hi all,  
> I have to do some statistics calculations (normal distribution, etc)  
> in Ruby and I don’t seem to find much of it in the language itself.  
> Would be the R statistics package the best solution so far?
> 
> Thanks in advance.

Hi,  
apart from a large statistic system like R, the GSL-bindings  
([http://rb-gsl.rubyforge.org](http://rb-gsl.rubyforge.org)) for Ruby provide an interface for rather  
simple statistical analysis, histograms, gaussian fits and plots. Have a  
look at:

[http://rb-gsl.rubyforge.org/stats.html](http://rb-gsl.rubyforge.org/stats.html)  
[http://rb-gsl.rubyforge.org/hist.html#8.3](http://rb-gsl.rubyforge.org/hist.html#8.3)  
[http://rb-gsl.rubyforge.org/vector.html](http://rb-gsl.rubyforge.org/vector.html)

regards  
ralf
