Euler Hall — free maths guides

Compute a sample standard deviation

Compute a sample variance and its square root. The idea in plain words, a worked example, and a check with the answers shown — part of the free Statistics guides.

A typical distance from the mean

The sample standard deviation is

s=∑(xi−xˉ)2n−1.s = \sqrt{\frac{\sum (x_i - \bar x)^2}{n-1}}.

Read it as the typical distance of a value from its sample mean. The units are the data's own, which is what makes it interpretable: a standard deviation of 2.1 cm is a distance in centimetres.

Two details decide whether the answer is right. The deviations are squared, so they are all positive and large ones count more. And the division is by *n−1n-1**, notnn — the sample correction, because the deviations were measured from the sample's own mean rather than from the population's.

Why square rather than take absolute values

Three reasons, in increasing importance. Squaring removes signs without a case analysis. It weights large deviations more, so a single distant value is not averaged away. And the resulting variance has the algebraic property that variances of independent quantities add, which is what makes the whole of inference work — a property the mean absolute deviation does not have.

The cost is real: a standard deviation is much less resistant than an IQR, and one outlier can dominate it. That is why a skewed set is summarised by a median and an IQR.

Worked example: eight values, step by step

Data:2,4,4,4,5,5,7,92, 4, 4, 4, 5, 5, 7, 9. The mean is40/8=540/8 = 5.

Squared deviations.(2−5)2=9(2-5)^2 = 9, three of(4−5)2=1(4-5)^2 = 1, two of(5−5)2=0(5-5)^2 = 0,(7−5)2=4(7-5)^2 = 4,(9−5)2=16(9-5)^2 = 16. Total=32= 32.

Variance.32/(8−1)=4.57132/(8-1) = 4.571.

Standard deviation.4.571=2.14\sqrt{4.571} = 2.14.

Check. The mean absolute deviation of the same data is14/8=1.7514/8 = 1.75, which is smaller — as it must be, because squaring gives the large deviations more weight.

By the end you can
  • Compute a sample variance and its square root
  • Divide byn−1n-1 and say why
  • Read a standard deviation as a typical distance from the mean
Check yourself
  1. 1. For4,6,84, 6, 8: what are the squared deviations from the mean?
  2. 2. What is the sample variance?
  3. 3. What is the sample standard deviation?
Answers
  1. 1.(4−6)2=4(4-6)^2 = 4,00,44 — a total of 8.
  2. 2.8/2=48/2 = 4.
  3. 3. 2.
Work out where to start — free, no accountAnswer six real questions — free, no account