Fork me on GitHub


Stats is a prototype to explore how intuitive we can make statistics in Ruby.

Starting out, the purpose of the library is to be readable (for people studying statistics), to be well-tested (against R and Python statistical functions), and to be useful for Small Data. Big Data can come later, if I have enough fun. With stats, I aim to create an API that makes statistics intuitive and harder to mess up. For example, I'd like to take a stab at an assumption framework that can tag specific functions with assumptions that will throw warnings if they're not met.


So far, the library features:

  • Standard statistics functions (listed below)
  • The basis for an assumption framework (which would detect invalid inputs where possible and throw warnings)

Distribution functions

I've added a wrapper around GSL distribution functions, for more intuitive access and testing.

  • Normal distribution - PDF & CDF
  • Chi square distribution - PDF & CDF
  • T distribution - PDF & CDF
  • F distribution - PDF & CDF

Basic functions

  • Mean, arithmetic
  • Mean, geometric
  • Median
  • Mode
  • Variance
  • Standard deviation
  • Standard error of the mean (for samples)
  • Relative standard error of the mean (for samples)
  • Coefficient of variation

Significance tests

  • Chi square
  • T-test, single sample
  • T-test, two-sample
  • T-test, repeated measures
  • Wilcoxon rank sum test
  • Kruskall-Wallis H test
  • ANOVA, one-way

Support & other

  • Basic assumption framework

Next up

Check out the README to see which functions I'd like to implement next.


Here are some statistical resources that will be incorporated into the assumptions framework: