class Array
Public Instance Methods
average()
click to toggle source
# File lib/gauntlet.rb, line 315 def average return self.sum / self.length.to_f end
sample_variance()
click to toggle source
# File lib/gauntlet.rb, line 319 def sample_variance avg = self.average sum = 0 self.each { |i| sum += (i - avg) ** 2 } return (1 / self.length.to_f * sum) end
stddev()
click to toggle source
# File lib/gauntlet.rb, line 326 def stddev return Math.sqrt(self.sample_variance) end
sum()
click to toggle source
# File lib/gauntlet.rb, line 309 def sum sum = 0 self.each { |i| sum += i } sum end