6.42.9 Statistics on lists: mean variance
stddev stddevp median quantile
quartiles boxwhisker
The functions described here can be used if a statistics series is
contained in a list. See also Section 6.45.16 for statistics on matrices
and Section 9 for more general statistics.
Let L be a list.
-
mean(L) computes the arithmetic mean of a list.
Examples.
-
Input:
mean([3,4,2])
Output:
- Input:
mean([1,0,1])
Output:
- stddev(L computes the standard deviation of a population,
for the population L.
Example.
Input:
stddev([3,4,2])
Output:
- stddevp(L) computes an unbiased estimate of
the standard deviation of the population for the sample L.
The following relation holds:
stddevp(L)2= | size(L)·stddev(L)2 |
|
size(L)−1 |
|
Example.
Input:
stddevp([3,4,2])
Output:
- variance(L) computes the variance of L, which is
the square of stddevp(L).
Example.
Input:
variance([3,4,2])
Output:
- median(L) computes the median of L.
Example.
Input:
median([0,1,3,4,2,5,6])
Output:
- quantile(L,d) computes the deciles of L,
where d is the decile.
Examples.
-
Input:
quantile([0,1,3,4,2,5,6],0.25)
Output (the first quartile):
- Input:
quantile([0,1,3,4,2,5,6],0.5)
Output (the median):
- Input:
quantile([0,1,3,4,2,5,6],0.75)
Output (the third quartile):
- quartiles(L) returns a list consisting of the minimum,
the first quartile, the median, the third quartile and the maximum of
L.
Example.
Input:
quartiles([0,1,3,4,2,5,6])
Output:
⎡
⎢
⎢
⎢
⎢
⎢
⎣ | | ⎤
⎥
⎥
⎥
⎥
⎥
⎦ |
- boxwhisker(L) draws the whisker box of a statistics series
stored in L.
Example.
Input:
boxwhisker([0,1,3,4,2,5,6])
Output:
Example.
Define the list A by:
Input:
A:=[0,1,2,3,4,5,6,7,8,9,10,11]:;
Then:
Input:
mean(A)
Output:
Input:
stddev(A)
Output:
Input:
quantile(A,0.1)
Output:
Input:
quantile(A,0.25)
Output:
Input:
median(A)
or:
quantile(A,0.5)
Output:
Input:
quantile(A,0.75)
Output:
Input:
quantile(A,0.9)
Output:
Input:
max(A)
Output:
Input:
quartiles(A)
Output:
⎡
⎢
⎢
⎢
⎢
⎢
⎣ | | ⎤
⎥
⎥
⎥
⎥
⎥
⎦ |