Commit ff287fc3 by Eric Coissac

Patch variance estimator for returning 0 for singleton

parent 3cea0f40
......@@ -97,6 +97,8 @@ def mean(values,options):
def variance(v):
if len(v)==1:
return 0
s = reduce(lambda x,y:(x[0]+y,x[1]+y**2),v,(0.,0.))
return s[1]/(len(v)-1) - s[0]**2/len(v)/(len(v)-1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment