shironosov/iStock/GettyImages
In any statistical test, including the widely used t‑test, the standard deviation is a fundamental measure of dispersion. For students, researchers, and data‑driven professionals, mastering how to calculate the sample standard deviation from raw data is essential for accurate inference.
When you estimate a characteristic of an entire population based on a subset of data, you must account for sampling variability. The population standard deviation (σ) describes the true spread of all possible observations, whereas the sample standard deviation (s) provides an unbiased estimate of σ using only the observed sample. Because full populations are rarely available, s is the statistic most commonly reported.
Follow these four simple steps. 1️⃣ Compute the sample mean (μ). 2️⃣ Measure the deviation of each observation from μ and square it. 3️⃣ Sum all squared deviations. 4️⃣ Divide by (n − 1) and take the square root.
Below is a worked example using ten heart‑rate observations (beats per minute):
71, 83, 63, 70, 75, 69, 62, 75, 66, 68
First, find the mean:
\[\mu = \frac{71+83+63+70+75+69+62+75+66+68}{10} = \frac{702}{10} = 70.2\]
Next, calculate squared deviations:
\[\begin{aligned} (71-70.2)^2 &= 0.8^2 = 0.64\\ (83-70.2)^2 &= 12.8^2 = 163.84\\ (63-70.2)^2 &= (-7.2)^2 = 51.84\\ (70-70.2)^2 &= (-0.2)^2 = 0.04\\ (75-70.2)^2 &= 4.8^2 = 23.04\\ (69-70.2)^2 &= (-1.2)^2 = 1.44\\ (62-70.2)^2 &= (-8.2)^2 = 67.24\\ (75-70.2)^2 &= 4.8^2 = 23.04\\ (66-70.2)^2 &= (-4.2)^2 = 17.64\\ (68-70.2)^2 &= (-2.2)^2 = 4.84 \end{aligned}\]
Sum of squared deviations:
\[0.64 + 163.84 + 51.84 + 0.04 + 23.04 + 1.44 + 67.24 + 23.04 + 17.64 + 4.84 = 353.6\]
Divide by degrees of freedom (n − 1 = 9) to obtain the sample variance:
\[s^2 = \frac{353.6}{9} = 39.289\]
Finally, take the square root to get the sample standard deviation:
\[s = \sqrt{39.289} \approx 6.27\]
If we were computing the population standard deviation, the only change would be to divide by n instead of n − 1.
The mean deviation (average absolute deviation from the mean) is calculated by taking the absolute value of each difference from the mean and averaging those values:
\[\frac{|71-70.2| + |83-70.2| + \dots + |68-70.2|}{10} = \frac{46.4}{10} = 4.64\]
Unlike the standard deviation, mean deviation does not involve squaring or rooting, resulting in a smaller value that reflects a different sense of spread.
By following these clear steps, you can reliably compute sample standard deviations for any dataset, ensuring rigorous statistical analysis and robust conclusions.