From: Chris B. <chr...@ho...> - 2001-08-28 17:19:21
|
Charles G Waldman wrote: > I think there are some statistics modules floating around on the Net, > but mean and standard deviation are one-liners in NumPy: > > from Numeric import * > > def mean(a): > return float(sum(a))/len(a) > > def std_dev(a): > return sqrt(mean((a-mean(a))**2)) or, for the unbiased estimate: def std_dev(a): return sqrt(sum((a-mean(a))**2)/(len(a)-1)) You can also find these in Mlab.py -Chris -- Christopher Barker, Ph.D. Chr...@ho... --- --- --- http://members.home.net/barkerlohmann ---@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Oil Spill Modeling ------ @ ------ @ ------ @ Water Resources Engineering ------- --------- -------- Coastal and Fluvial Hydrodynamics -------------------------------------- ------------------------------------------------------------------------ |