Sha256: fb4aca938116994e95260e04a76ecd88994458aec6a3aa9ef2775e7c74995c1d
Contents?: true
Size: 338 Bytes
Versions: 4
Compression:
Stored size: 338 Bytes
Contents
module Enumerable def sum self.inject(0){|accum, i| accum + i } end def mean self.sum/self.length.to_f end def sample_variance m = self.mean sum = self.inject(0){|accum, i| accum +(i-m)**2 } sum/(self.length - 1).to_f end def standard_deviation return Math.sqrt(self.sample_variance) end end
Version data entries
4 entries across 4 versions & 1 rubygems