Standard Deviation Explained: Sample or Population
What standard deviation measures, how to work it out step by step, why a sample divides by n minus 1, and a worked example you can check.
In this article
Standard deviation is a number that tells you how spread out a set of values is. If the numbers cluster tightly around their average, the standard deviation is small. If they are scattered widely, it is large. Two classes can have the same average mark and still be very different: in one every student scored close to the average, in the other some scored very high and some very low. Standard deviation captures that difference. This guide shows how it is calculated and how to choose between the two versions, using examples you can enter into the Standard Deviation Calculator.
The steps
The calculation has the same few steps every time. First find the mean by adding all the values and dividing by how many there are. Then, for each value, find how far it is from the mean and square that distance, which makes every distance positive and gives larger gaps more weight. Add up those squares. Divide by the count, or by one less than the count for a sample, to get the variance. Finally take the square root of the variance to return to the original unit. Wikipedia describes the standard deviation as the square root of the variance, which is why the answer is in the same unit as your data.
A worked example
Take the eight values 2, 4, 4, 4, 5, 5, 7 and 9. The sum is 40 and there are 8 values, so the mean is 5. The distances from the mean are −3, −1, −1, −1, 0, 0, 2 and 4, and their squares are 9, 1, 1, 1, 0, 0, 4 and 16. These add up to 32. If the eight values are the entire population, the variance is 32 ÷ 8 = 4, and the standard deviation is √4 = 2. If they are a sample, the variance is 32 ÷ 7 = 4.571 and the standard deviation is √4.571 = 2.138.
A second example uses five test marks: 70, 75, 80, 85 and 90. The mean is 80. The distances are −10, −5, 0, 5 and 10, with squares 100, 25, 0, 25 and 100, a total of 250. As a population the variance is 250 ÷ 5 = 50 and the standard deviation is 7.071. As a sample it is 250 ÷ 4 = 62.5 and the standard deviation is 7.906.
Sample or population?
Use the population version when your numbers are everything you care about, for example the marks of every student in one class when you only want to describe that class. Use the sample version when your numbers are a sample drawn from a larger group and you want to estimate the spread of that larger group, for example 50 customers surveyed out of thousands. The population formula divides by n. The sample formula divides by n − 1, which is known as Bessel's correction. A sample's values tend to sit closer to the sample's own mean than to the true mean of the whole group, so dividing by n would underestimate the spread, and dividing by n − 1 corrects for that on average. The difference matters most for small sets and fades as the count grows.
Reading the result
For data that follows a bell-shaped normal distribution, about 68 per cent of values fall within one standard deviation of the mean, about 95 per cent within two, and about 99.7 per cent within three. Wikipedia describes this rule. In the marks example, a mean of 80 and a sample deviation of 7.9 would suggest most students scored between roughly 72 and 88. The rule is a guide for bell-shaped data and should not be applied to data that is heavily lopsided.
- A standard deviation of 0 means every value is the same
- A bigger standard deviation means more spread, not larger values
- It has the same unit as the data, so the standard deviation of heights in centimetres is in centimetres
- It is sensitive to outliers, because the distances are squared
- The variance is the standard deviation squared, and is not in the original unit
Common mistakes
The most common mistake is choosing the wrong version. If you are unsure and the numbers are a subset of something bigger, the sample version is the safer choice. Other mistakes are forgetting to take the square root at the end, which gives the variance instead, and rounding the mean too early. Keep the mean exact, or as many digits as you can, until the end. The calculator on this site keeps full precision throughout and shows the steps, including the squared distance of the first few values.
Sources
Share
Keep reading
Related articles
How a Scientific Calculator Works Out an Expression
How the order of operations, brackets, powers, functions and degrees or radians decide the answer to a typed expression, with examples to check.
How to Solve a Triangle: Sides, Angles and Area
How to find every side, angle, the perimeter and the area of a triangle from three sides, two sides and the angle between them, or two angles and a side.
How Random Numbers Are Made, and How to Pick One Fairly
How a random number generator turns random bits into a fair pick from a range, why a simple remainder can be biased, and when to use unique numbers.