What Is Standard Deviation?
Standard deviation is a statistical measure that quantifies the amount of variation or dispersion in a set of data values. A low standard deviation indicates that the data points tend to be close to the mean (expected value) of the set, while a high standard deviation indicates that the data points are spread out over a wider range of values. Represented by the Greek letter σ (sigma) for populations and s for samples, it is one of the most fundamental concepts in descriptive statistics.
Core Definition
Population vs. Sample Standard Deviation
Before calculating standard deviation, you must determine whether your data represents an entire population or a sample of a population. A population includes all members of a specified group, whereas a sample is a representative subset of that group. Calculating the standard deviation for a sample requires a mathematical adjustment—using n - 1 (degrees of freedom, or df) instead of N—to ensure the result is an unbiased estimator of the population variance.
Population Standard Deviation
Sample Standard Deviation
The Standard Deviation Formula Explained
The formulas for standard deviation rely on calculating the variance first, and then taking the square root. This square root step is crucial because it brings the measure of spread back into the original units of the data. The key components are xᵢ (each individual value), μ or x̄ (the population or sample mean), and N or n (the total number of values).
Population SD
Sample SD
Step-by-Step Calculation Example
Let's calculate the sample standard deviation for a small dataset of test scores: [4, 8, 6, 5, 3, 2, 8, 9, 2, 5]. Following the formula step-by-step reveals how the variance accumulates before we take the final square root.
Calculate the Mean (x̄)
Subtract the Mean and Square the Result
Sum the Squared Differences
Divide by n - 1 (Degrees of Freedom)
Take the Square Root
Calculating Standard Deviation in Python
Calculating standard deviation manually is prone to error, especially with large datasets. In practice, statisticians and data scientists use programming languages like Python to compute it instantly using built-in libraries.
import statistics
data = [4, 8, 6, 5, 3, 2, 8, 9, 2, 5]
# Calculate sample standard deviation (default)
sample_sd = statistics.stdev(data)
print(f"Sample SD: {sample_sd:.2f}")
# Calculate population standard deviation
pop_sd = statistics.pstdev(data)
print(f"Population SD: {pop_sd:.2f}")The Empirical Rule and Standard Deviation
When data follows a normal distribution (bell curve), the standard deviation becomes incredibly predictive. The Empirical Rule, also known as the 68-95-99.7 rule, states that nearly all data will fall within three standard deviations of the mean. This allows analysts to quickly identify outliers and understand the probability of a specific observation occurring.
| Interval from Mean | Percentage of Data | Application |
|---|---|---|
| ±1σ | 68.27% | Identifying typical, everyday values |
| ±2σ | 95.45% | Setting confidence intervals |
| ±3σ | 99.73% | Detecting extreme outliers |
Standard Deviation vs. Variance
Variance and standard deviation are closely related measures of spread. Variance (σ² or s²) is the average of the squared differences from the Mean, while standard deviation is the square root of the variance. Because variance is expressed in squared units (e.g., square dollars, square inches), it can be difficult to interpret in the context of the original data. Standard deviation resolves this by converting the measure back into the original units.
Reporting Your Data
Common Pitfalls to Avoid
While standard deviation is a powerful tool, it is frequently misused. Misapplying the formulas or misunderstanding what the value represents can lead to flawed data analysis and incorrect conclusions.
- Using the population formula for a sample: Forgetting to use n - 1 for samples artificially lowers the calculated spread, underestimating the true population variance.
- Applying SD to non-normal distributions: The Empirical Rule only applies to normal distributions. For highly skewed data, SD might not accurately reflect the spread.
- Confusing SD with Standard Error: The standard error measures the precision of a sample mean estimate, while standard deviation measures the spread of the underlying data itself.
Watch Out for Outliers
Further Reading
Sources
References and further authoritative reading used in preparing this article.