Standard deviation

### 18.1.3 Standard deviation

Standard deviation is potentially better than variance to measure how close numbers are to their mean. The standard deviation is the square root of the variance; for example, the list [1,2,3,4] has mean 5/2, and so the standard deviation will be 2√5/4, since

√
(1−5/2)2+(2−5/2)2+(3−5/2)2+(4−5/2)2
4
| = |
2 | √ |
5
4
| .

Note that if the list of numbers have units, then the standard deviation will have the same unit.

The stddev command finds the standard deviation.

- stddev takes one mandatory argument and one optional argument:
  - L, a list or matrix of numbers.
  - W, a list or matrix of weights, the same size as L.
- stddev(L ⟨,W⟩) returns the standard deviation of the list or a list with the standard deviations of the columns of the matrix.

#### Examples

stddev([1,2,3,4])

√ |
5
2

stddev([1,2,3],[2,1,1])

4
16
|  | √ |
11

stddev([[1,2],[3,6]])

| ⎡ ⎣ | 1,2 | ⎤ ⎦