Returns the variance of the given list of values. The variance is the average of squared deviations from the mean.
(list)
| 340 | return float(_sum(list)) / (len(list) or 1) |
| 341 | |
| 342 | def variance(list): |
| 343 | """ Returns the variance of the given list of values. |
| 344 | The variance is the average of squared deviations from the mean. |
| 345 | """ |
| 346 | a = avg(list) |
| 347 | return _sum([(x-a)**2 for x in list]) / (len(list)-1 or 1) |
| 348 | |
| 349 | def stdev(list): |
| 350 | """ Returns the standard deviation of the given list of values. |