Sha256: 120d4adbd900f68d7dc574f2dabd42a92baa4f7c3d6971fb13405171a4984f93
Contents?: true
Size: 328 Bytes
Versions: 2
Compression:
Stored size: 328 Bytes
Contents
class Array def central_moment(k) if k < 0 nil else mean = self.mean (1.0 / self.length) * self.map{ |x| (x - mean) ** k }.sum end end def raw_moment(k) if k < 0 nil else (1.0 / self.length) * self.map{ |x| x ** k }.sum end end # def l_moment k # # end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rstat-0.1.2 | lib/rstat/core_ext/array/descriptive_statistics/shape/moment.rb |
rstat-0.1.1 | lib/rstat/core_ext/array/descriptive_statistics/shape/moment.rb |