[issue21046] Document formulas used in statistics

Alextp report at bugs.python.org
Mon Mar 24 17:11:36 CET 2014


Alextp added the comment:

I'm author or topic

I suggest to give simple formulas. for ex -

1) mean. 
Calculates sum of all values in iterable, divided by number of elements. 
E.g. 
mean([x1, x2, ..., xN]) = (x1 + x2 + ... + xN) / N

2) median. 
Calculates value with middle index from iterable. 
If number of elements is even, ie no strict middle index exists, then function takes average of two values at two indexes near middle.

E.g.
median([x1, x2, x3, x4, x5]) = x3
median([x1, x2, x3, x4, x5, x6]) = (x3 + x4) / 2

3) median_low.
 Calculates value with middle index from iterable. 
If number of elements is even, ie no strict middle index exists, then function takes value at near index, lower than middle.


4) median_high.
 Calculates value with middle index from iterable. 
If number of elements is even, ie no strict middle index exists, then function takes value at near index, higher than middle.

5) median_grouped.
(((NOTE!! I may not understand median_grouped OK)))
Calculates average of values of iterable at L given middle indexes.

E.g.
median_grouped([x1, x2, x3, x4, x5], L=3) = (x2+x3+x4)/3

NOTE: pls check this!

----------
nosy: +Alextp

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21046>
_______________________________________


More information about the Python-bugs-list mailing list