1.8 Standard Deviation

The standard deviation is a far better measure of spread than the range, because it uses every observation rather than only the two extremes, and so is not overturned by a single unusual value. It measures how far a typical observation lies from the mean.

The idea is straightforward. Take each deviation \(X-\overline {X}\); square it, so that values above and below the mean both count as spread instead of cancelling; average the squares; then take the square root to return to the original units. The averaged square is the variance, \(\sigma ^2\), and its square root is the standard deviation, \(\sigma \).

1.8.1 Population and sample: why the divisor changes

There are two versions of this calculation, and using the wrong one is among the commonest mistakes in the subject. Which applies depends on what the data are.

Definition 1.30 (Population variance). When the data are the entire population, divide by \(N\): \[\sigma ^2=\frac {\sum (X-\mu )^2}{N},\qquad \sigma =\sqrt {\sigma ^2}.\]

Definition 1.31 (Sample variance). When the data are a sample drawn from a larger population, divide by \(n-1\): \[s^2=\frac {\sum (X-\overline {X})^2}{n-1},\qquad s=\sqrt {s^2}.\]

Remark 1.32. The \(n-1\) is not an arbitrary correction. A sample’s own mean \(\overline {X}\) is, by construction, the point about which that sample’s squared deviations are smallest – smaller than they would be about the true population mean \(\mu \), which we do not know. Dividing by \(n\) would therefore systematically underestimate the population variance. Dividing by \(n-1\) compensates exactly, and makes \(s^2\) an unbiased estimator of \(\sigma ^2\).

Another way to see it: the \(n\) deviations are not free to take any values, because they are forced to sum to zero. Once \(n-1\) of them are known the last is determined, so there are only \(n-1\) independent pieces of information about the spread. That count is the degrees of freedom, and the same reasoning reappears throughout the course – \(n-1\) for a \(t\) interval, \(n-k\) in the analysis of variance, \(n-2\) in regression.

In practice: use \(N\) only when you genuinely have every member of the population – every pupil in one class, say. If the data are a sample and you want to say something about the wider population, use \(n-1\). When \(n\) is large the two barely differ; when \(n\) is small they differ a great deal, which is exactly when it matters.

The formulas below are written with \(\sigma \) and divisor \(n\), which is correct when the data at hand are the whole population. For a sample, replace \(n\) by \(n-1\) throughout.

\begin {align*} & \textbf {Notation}\\ \sum &- \text {Summation}\\ \sigma ^2 &- \text {Variance}\\ \sigma &- \text {Standard Deviation}\\ X &- \text {Variable}\\ \overline {X} &- \text {Mean}\\ n &- \text {Number of observations}\\ \end {align*}

We can calculate the standard deviation from either ungrouped data or grouped data.

1.
Ungrouped Data
The formula used to calculate s.d. for ungrouped data is \[\sigma =\sqrt {\frac {\sum (X-\overline {X})^2}{n}}\]

Example 1.33. Calculate \(\sigma \) for the following values: 0, 1, 3, 5, 6

Solution.

\(\displaystyle {\overline {X}=\frac {0+1+3+5+6}{5}=\frac {15}{5}=3\hspace {1cm}\implies \hspace {0.5cm} \overline {X}=3}\)

Value \(X-\overline {X}\) \((X-\overline {X})^2\)
0 \(-3\) 9
1 \(-2\) 4
3 0 0
5 2 4
6 3 9
0 26

\begin {align*} \sigma ^2 &=\frac {\sum (X-\overline {X})^2}{n}=\frac {26}{5}\\\\ \implies \hspace {0.5cm} \sigma &=\pm \sqrt {\frac {26}{5}}\\\\ \implies \hspace {0.5cm}\sigma & =2.28035085\hspace {1cm} \implies \hspace {0.5cm} \sigma \approx 2.28\\ \end {align*} Calculation of \(\sigma \) from grouped data \[\sigma =\sqrt {\frac {\sum (X-\overline {X})^2}{\sum f}}\]

\(X\) \(f\) \(f(X)\) \(X-\overline {X}\) \((X-\overline {X})^2\) \(f(X-\overline {X})^2\)
0 3 0 \(-1.1\) 1.21 3.63
1 4 4 \(-0.1\) 0.01 0.04
2 2 4 0.9 0.81 1.62
3 1 3 1.9 3.61 3.61
10 11 8.90

\[\sigma =\sqrt {\frac {\sum f(X-\overline {X})^2}{\sum f}}=\sqrt {\frac {8.90}{10}}=\sqrt {0.89}\hspace {1cm}\implies \hspace {0.5cm} \sigma =0.94\]

Example 1.34. Calculate the standard deviation of the grouped data below.

C.I \(4\)–\(6\) \(7\)–\(9\) \(10\)–\(12\) \(13\)–\(15\) \(16\)–\(18\)
\(f\) 1 3 5 2 1

Solution. Represent each class by its mid-point and build the \(fX\) and \(fX^2\) columns. Using \[\sigma ^2=\frac {\sum fX^2}{\sum f}-\left (\frac {\sum fX}{\sum f}\right )^{2}\] avoids computing every deviation separately.

C.I Mid-point \(X\) \(f\) \(fX\) \(fX^2\)
\(4\)–\(6\) 5 1 5 25
\(7\)–\(9\) 8 3 24 192
\(10\)–\(12\) 11 5 55 605
\(13\)–\(15\) 14 2 28 392
\(16\)–\(18\) 17 1 17 289
Total 12 129 1503

\[\overline {X}=\frac {129}{12}=10.75,\] \[\sigma ^2=\frac {1503}{12}-(10.75)^2=125.25-115.5625=9.6875,\] \[\sigma =\sqrt {9.6875}=3.11.\] If these 12 observations were a sample rather than the whole population, the divisor would be \(n-1=11\), giving \(s^2=10.57\) and \(s=3.25\) – noticeably larger, because \(n\) is small.

Questions on this section

Stuck on something here? Ask below and it stays attached to this topic.