### 14.5.2 Matrices

The functions described in Section 14.5.1 can also find finds statistics for the columns of a matrix.

Let A be a matrix.

- mean(A) computes the arithmetic means of the columns of the matrix A.
- stddev(A computes the standard deviations for the populations given by the columns of A.
- stddevp(A) computes the unbiased estimates of the standard deviations of the populations for the samples given by the columns of A.
- variance(A) computes the variances of the columns of A.
- median(A) computes the medians of the columns of A.
- quantile(A,d) computes the deciles of the columns of A, where d is the decile.
- quartiles(A) returns a matrix where each column consists of the minimum, the first quartile, the median, the third quartile and the maximum of the corresponding column of A.

  The output is a matrix, its first row is the minima of each column, its second row is the first quartiles of each column, its third row the medians of each column, its fourth row the third quartiles of each column and its last row the maxima of each column.

- boxwhisker(A) draws the whisker box of the statistics series stored in the columns of A.

#### Examples

With

A:=[[3,4,2],[1,2,6]]

input:

mean(A)

| ⎡ ⎣ | 2,3,4 | ⎤ ⎦

stddev(A)

| ⎡ ⎣ | 1,1,2 | ⎤ ⎦

stddevp(A)

⎡
⎢
⎣

√

2

,

√

2

,2

√

2

⎤
⎥
⎦

variance(A)

| ⎡ ⎣ | 1,1,4 | ⎤ ⎦

With

B:=[[6,0,1,3,4,2,5],[0,1,3,4,2,5,6],[1,3,4,2,5,6,0], [3,4,2,5,6,0,1],[4,2,5,6,0,1,3],[2,5,6,0,1,3,4]]

input:

median(B)

| ⎡ ⎣ | 2.0,2.0,3.0,3.0,2.0,2.0,3.0 | ⎤ ⎦

To obtain the first quartiles of the columns:

quantile(B,0.25)

| ⎡ ⎣ | 1.0,1.0,2.0,2.0,1.0,1.0,1.0 | ⎤ ⎦

To obtain the third quartiles of the columns:

quantile(B,0.75)

| ⎡ ⎣ | 4.0,4.0,5.0,5.0,5.0,5.0,5.0 | ⎤ ⎦

quartiles(B)

⎡
⎢
⎢
⎢
⎢
⎢
⎣

0.0 | 0.0 | 1.0 | 0.0 | 0.0 | 0.0 | 0.0
1.0 | 1.0 | 2.0 | 2.0 | 1.0 | 1.0 | 1.0
2.0 | 2.0 | 3.0 | 3.0 | 2.0 | 2.0 | 3.0
4.0 | 4.0 | 5.0 | 5.0 | 5.0 | 5.0 | 5.0
6.0 | 5.0 | 6.0 | 6.0 | 6.0 | 6.0 | 6.0

⎤
⎥
⎥
⎥
⎥
⎥
⎦

boxwhisker(B)