letx=

Probability and statistics

Standard deviation

How spread out data are: roughly the typical distance of a value from the mean. Shows both the population (σ) and sample (s) versions.

σ=∑(xi−μ)2N
Sample standard deviations=∑(xi−x¯)2n−1
Varianceσ2=∑(xi−μ)2N

Calculator

The live calculator needs JavaScript. The worked example below shows the same steps it would.

What the symbols mean

σ
the population standard deviation: the data are the whole group you care about
s
the sample standard deviation: the data are a sample from a bigger population
xi
the data values xi
μ
the mean of the data (x¯ for a sample)
N
the number of values (n for a sample)

When to use it

Use it to compare how consistent two sets of results are, to describe the spread of measurements, and as the σ in z-scores and the normal distribution. Divide by N when the data are the entire population (every student in one class); divide by n−1 when they are a sample used to estimate a bigger population (most surveys and experiments). Spreadsheets call these STDEV.P and STDEV.S.

Worked example

Find the standard deviation of 2, 4, 4, 4, 5, 5, 7, 9, treating these eight values as the whole population.

  1. Start from the population formula (divide by N, the number of values).

    σ=∑(xi−μ)2N
  2. Add up all 8 values.

    ∑xi=2+4+4+4+5+5+7+9=40
  3. Divide by the number of values, n = 8.

    μ=408
    =5
  4. Square each value's distance from the mean and add them up (the sum of squares).

    ∑(x−μ)2=(2−5)2+(4−5)2+(4−5)2+(4−5)2+(5−5)2+(5−5)2+(7−5)2+(9−5)2=9+1+1+1+0+0+4+16=32
  5. Divide by N = 8 to get the variance.

    σ2=328
    =4
  6. Take the square root to get back to the units of the data.

    σ=4
    =2
  7. If these values are a sample from a bigger population, divide by n − 1 = 7 instead: s = 2.13809.

Answer σ = 2

Why it works

Distances from the mean add up to zero, so they are squared first (which also weights large deviations more), averaged to give the variance, and square-rooted to return to the data's units. Dividing a sample by n−1 (Bessel's correction) compensates for measuring distances from the sample's own mean, which is always a little closer to the data than the true mean is.

Common mistakes

  • Forgetting the square root and quoting the variance (4 here) as the standard deviation.
  • Using N when the data are a sample, which understates the spread; or n−1 for a complete population.
  • Squaring the total deviation instead of each deviation: the deviations must be squared one by one, then added.