Statistical functions for Ruby