Skip to content

Commit

Permalink
fix [].mean method
Browse files Browse the repository at this point in the history
  • Loading branch information
IsmailM committed Nov 10, 2015
1 parent d14931c commit 1ba8a83
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/statsample.rb
Expand Up @@ -59,13 +59,13 @@ def sum
end

def mean
self.sum / size
sum.fdiv(size)
end

# Calcualte sum of squares
def sum_of_squares(m=nil)
m ||= mean
self.inject(0) {|a,x| a + (x-m).square }
inject(0) {|a,x| a + (x-m).square }
end

# Calculate sample variance
Expand Down

0 comments on commit 1ba8a83

Please sign in to comment.