01 / 20

Variance &
Standard Deviation

Learn how to measure the spread of biological data using variance \(\sigma^2\) and standard deviation \(\sigma\): the essential tools of biostatistics.

Biostatistics

Why Spread Matters in Biology

Two groups of patients can share the same mean blood pressure yet differ dramatically in how variable their readings are. The mean alone hides crucial information: one group might be stable while the other swings dangerously.

What is Variance?

Variance is the average of the squared deviations from the mean. Squaring ensures that positive and negative deviations don't cancel out, giving a pure measure of total spread.

Population Variance
\(\displaystyle \sigma^2 = \frac{1}{N}\sum_{i=1}^{N}(x_i - \mu)^2\)
Sample Variance
\(\displaystyle s^2 = \frac{1}{n-1}\sum_{i=1}^{n}(x_i - \bar{x})^2\)

What is Standard Deviation?

Standard deviation is simply the square root of variance. It converts spread back into the original units of measurement, making it far easier to interpret.

Population SD
\(\displaystyle \sigma = \sqrt{\sigma^2} = \sqrt{\frac{1}{N}\sum(x_i - \mu)^2}\)
Sample SD
\(\displaystyle s = \sqrt{s^2} = \sqrt{\frac{1}{n-1}\sum(x_i - \bar{x})^2}\)

Visualizing Low vs High Spread

Low Variance
\(\sigma = 2\)
\(\mu\)
High Variance
\(\sigma = 8\)
\(\mu\)
\(1\sigma\) each side
\(1\sigma\) each side

The Core Formulas

Population
\(\displaystyle \sigma^2 = \frac{\sum(x_i - \mu)^2}{N}\)
Sample
\(\displaystyle s^2 = \frac{\sum(x_i - \bar{x})^2}{n - 1}\)
\(\sqrt{\phantom{x}}\)
\(\sqrt{\phantom{x}}\)
\(\sigma = \sqrt{\sigma^2}\)
\(s = \sqrt{s^2}\)

Population vs Sample

Feature Population Sample
Symbol (variance) \(\sigma^2\) \(s^2\)
Symbol (SD) \(\sigma\) \(s\)
Mean symbol \(\mu\) \(\bar{x}\)
Denominator \(N\) \(n - 1\)
When to use Entire group known Subset of population

How to Compute Step by Step

1
Find the mean. Add all values and divide by \(n\): \(\bar{x} = \frac{\sum x_i}{n}\).
2
Subtract the mean from each value. Compute each deviation: \(x_i - \bar{x}\).
3
Square every deviation. This removes negative signs: \((x_i - \bar{x})^2\).
4
Sum the squared deviations. \(\displaystyle \sum(x_i - \bar{x})^2\).
5
Divide by \(n - 1\) for sample variance \(s^2\). Take the square root for \(s\).

Example 1: Hemoglobin Levels

Five patients have hemoglobin (\(\text{g/dL}\)): 12, 14, 13, 15, 11. Compute the sample standard deviation.

11 12 13 14 15
\(\bar{x} = 13\)
\(\bar{x} = \frac{12+14+13+15+11}{5} = \frac{65}{5} = 13\)
\(\sum(x_i - \bar{x})^2 = (-1)^2 + 1^2 + 0^2 + 2^2 + (-2)^2 = 1+1+0+4+4 = 10\)
\(s^2 = \frac{10}{5-1} = \frac{10}{4} = 2.5\)
\(s = \sqrt{2.5} \approx 1.58 \text{ g/dL}\)

Example 2: Blood Glucose

Six fasting glucose readings (\(\text{mg/dL}\)): 90, 95, 88, 102, 97, 92. Find \(s\).

1
Mean: \(\bar{x} = \frac{90+95+88+102+97+92}{6} = \frac{564}{6} = 94\)
2
Deviations: \(-4,\ 1,\ -6,\ 8,\ 3,\ -2\)
3
Squared: \(16 + 1 + 36 + 64 + 9 + 4 = 130\)
4
Variance: \(s^2 = \frac{130}{6 - 1} = \frac{130}{5} = 26\)
5
SD: \(s = \sqrt{26} \approx 5.10 \text{ mg/dL}\)

Example 3: Comparing Two Groups

Drug A produces heart rates: 70, 72, 68, 71, 69.
Drug B produces heart rates: 60, 82, 65, 78, 65.
Both have \(\bar{x} = 70 \text{ bpm}\). Which is more variable?

Measure Drug A Drug B
\(\bar{x}\) \(70 \text{ bpm}\) \(70 \text{ bpm}\)
\(\sum(x_i - \bar{x})^2\) 10 358
\(s^2\) 2.5 89.5
\(s\) \(1.58 \text{ bpm}\) \(9.46 \text{ bpm}\)

The 68-95-99.7 Rule

For approximately normal distributions (common in biological data), the Empirical Rule gives a quick interpretation of standard deviation:

\(\mu\)
68%
95% within \(2\sigma\)
\(-1\sigma\)
\(+1\sigma\)
\(-2\sigma\)
\(+2\sigma\)
68%
within \(\pm 1\sigma\)
95%
within \(\pm 2\sigma\)
99.7%
within \(\pm 3\sigma\)

Why \(n - 1\)? Degrees of Freedom

When you estimate the mean from the same sample, you use up one piece of information. Only \(n - 1\) deviations are truly free to vary: the last one is forced so the deviations sum to zero.

Free Free Free Free Locked
\(n = 5\) values, but only \(n - 1 = 4\) are free
The last deviation is determined by the constraint:
\(\sum(x_i - \bar{x}) = 0\)

Variance vs Standard Deviation

Feature Variance (\(s^2\)) Std Dev (\(s\))
Units Squared (e.g., \(\text{bpm}^2\)) Original (e.g., \(\text{bpm}\))
Interpretability Hard to interpret directly Directly meaningful
Used in formulas ANOVA, regression Confidence intervals, z-scores
Sensitivity to outliers High (amplified by squaring) Moderate
Always non-negative Yes (\(\geq 0\)) Yes (\(\geq 0\))

Common Mistakes

✕ Dividing by \(n\)
Using \(n\) instead of \(n - 1\) for sample variance underestimates the true spread. Always use Bessel's correction for samples.
✕ Forgetting to square
Averaging raw deviations gives zero (they cancel out). You must square each deviation before summing.
✕ Confusing \(s^2\) and \(s\)
Reporting variance when SD is asked (or vice versa). Remember: SD = \(\sqrt{\text{variance}}\). Check the units.

Question 1 of 5

A sample of 4 values has a sum of squared deviations \(\sum(x_i - \bar{x})^2 = 24\). What is the sample variance \(s^2\)?

Question 2 of 5

If the sample variance of a data set is \(s^2 = 36\), what is the sample standard deviation?

Question 3 of 5

Why does the sample variance formula divide by \(n - 1\) instead of \(n\)?

Question 4 of 5

In a normally distributed population with \(\mu = 100\) and \(\sigma = 15\), approximately what percentage of values fall between 70 and 130?

Question 5 of 5

A researcher measures enzyme activity (\(\text{U/L}\)) in 5 samples: 10, 10, 10, 10, 10. What are the variance and standard deviation?