Statistics Standard Deviation
Standard deviation measures how spread out the values in a dataset are around the mean, expressed in the same units as the original data.
What Does Standard Deviation Measure?
Two datasets can have exactly the same mean but look completely different. The mean alone does not tell you whether values are tightly clustered together or scattered widely. Standard deviation fills that gap by measuring, on average, how far each value sits from the mean.
Consider two delivery drivers whose average delivery time is 30 minutes. Driver A's times are 28, 29, 30, 31, and 32 minutes - very consistent. Driver B's times are 10, 20, 30, 40, and 50 minutes - wildly inconsistent, even though the average is also exactly 30. Standard deviation is what lets you say that Driver A is far more predictable than Driver B.
Calculating Standard Deviation Step by Step
- Find the mean of the dataset.
- Subtract the mean from each value to get its deviation.
- Square each deviation, so negative and positive deviations do not cancel out.
- Average the squared deviations - this average is called the variance.
- Take the square root of the variance to get the standard deviation, back in the original units.
Example
delivery_times = [10, 20, 30, 40, 50] # minutes, Driver B
mean = sum(delivery_times) / len(delivery_times)
squared_diffs = []
for time in delivery_times:
squared_diffs.append((time - mean) ** 2)
variance = sum(squared_diffs) / len(delivery_times)
std_dev = variance ** 0.5
print("Mean:", mean)
print("Variance:", variance)
print("Standard deviation:", round(std_dev, 2))
# Mean: 30.0
# Variance: 200.0
# Standard deviation: 14.14Example
import statistics
delivery_times = [10, 20, 30, 40, 50]
print("Population std dev:", statistics.pstdev(delivery_times))
print("Sample std dev:", statistics.stdev(delivery_times))
# Population std dev: 14.142135623730951
# Sample std dev: 15.811388300841896Population vs Sample Standard Deviation
Driver A's standard deviation works out to only about 1.41 minutes, while Driver B's is 14.14 minutes - ten times larger, even though both drivers average 30 minutes per delivery. When the five values you have ARE the entire population, divide the sum of squared deviations by n. When your data is only a SAMPLE meant to estimate a larger population, statisticians divide by (n - 1) instead - a correction that gives a slightly larger, less biased estimate of the population's true spread.