# Statistics on lists: mean variance stddev stddevp median quantile quartiles boxwhisker

### 5.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 5.45.16 for statistics on matrices and Section 8 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:

    3

  - Input:
    mean([1,0,1])
    Output:

    2
    3

- stddev(L computes the standard deviation of a population, for the population L.

  #### Example.

  Input:

  stddev([3,4,2])

  Output:

  √

  6

  3

- 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:

  1

- variance(L) computes the variance of L, which is the square of stddevp(L).

  #### Example.

  Input:

  variance([3,4,2])

  Output:

  2
  3

- median(L) computes the median of L.

  #### Example.

  Input:

  median([0,1,3,4,2,5,6])

  Output:

  3.0

- 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):

    1.0

  - Input:
    quantile([0,1,3,4,2,5,6],0.5)
    Output (the median):

    3.0

  - Input:
    quantile([0,1,3,4,2,5,6],0.75)
    Output (the third quartile):

    5.0

- 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:

  ⎡
  ⎢
  ⎢
  ⎢
  ⎢
  ⎢
  ⎣

  0.0
  1.0
  3.0
  5.0
  6.0

  ⎤
  ⎥
  ⎥
  ⎥
  ⎥
  ⎥
  ⎦

- 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:

11
2

Input:

stddev(A)

Output:

2
12

√

429

Input:

quantile(A,0.1)

Output:

1.0

Input:

quantile(A,0.25)

Output:

2.0

Input:

median(A)

or:

quantile(A,0.5)

Output:

5.0

Input:

quantile(A,0.75)

Output:

8.0

Input:

quantile(A,0.9)

Output:

10.0

Input:

max(A)

Output:

11

Input:

quartiles(A)

Output:

⎡
⎢
⎢
⎢
⎢
⎢
⎣

0.0
2.0
5.0
8.0
11.0

⎤
⎥
⎥
⎥
⎥
⎥
⎦