Biostatistics · Intermediate

The sample variance

Written by SignalsLab

Early edition: these lessons are being reviewed.

Content

Summary

Sample variance (S2) quantifies data dispersion by averaging the squared deviations from the sample mean, using n−1 in the denominator to correct for bias. This adjustment, known as Bessel's correction, ensures the statistic is an unbiased estimator of the population variance. As sample size increases, the estimate becomes more precise and concentrated around the true population parameter.

Intuition

When we calculate variance using the sample mean (X‾) instead of the true population mean, the data points tend to be closer to the sample mean than they would be to the population mean. This causes the sum of squared deviations to be systematically smaller than it should be for the whole population. By dividing by n−1 rather than n, we inflate the result slightly to compensate for this underestimation. This makes the sample variance an 'unbiased' estimator, meaning that if we repeated the sampling process many times, the average of our calculated variances would equal the true population variance. Larger samples reduce the variability of this estimate, making it more reliable.

Key equations

S2=∑i=1n(Xi−X‾)2n−1
(1)

The formula for sample variance, where the sum of squared deviations from the sample mean is divided by n−1.

E[S2]=population variance
(2)

The expected value of the sample variance equals the true population variance, demonstrating its unbiasedness.

Derivation

  1. Calculate the sample mean (X‾) of the dataset.
  2. Compute the deviation of each observation (Xi) from the sample mean (Xi−X‾).
  3. Square each deviation to eliminate negative signs and emphasize larger discrepancies.
  4. Sum all squared deviations.
  5. Divide the sum by n−1 (Bessel's correction) to obtain an unbiased estimate of the population variance.

Worked example

Problem

A dataset of 10 observations has a mean of 94 and a sum of squared deviations from the mean equal to 210. Calculate the sample variance and sample standard deviation.

  1. Identify the sum of squared deviations: 210.
  2. Identify the sample size: n=10.
  3. Apply Bessel's correction by dividing by n−1: 10−1=9.
  4. Calculate sample variance: S2=210/9≈23.33.
  5. Calculate sample standard deviation by taking the square root of the variance: 23.33≈4.83.

Answer Sample Variance (S2) is approximately 23.33; Sample Standard Deviation (s) is approximately 4.83.

Common mistakes

  • Using N (population size) as the divisor for sample data, which systematically underestimates the true population variance.
  • Confusing sample variance (n−1 divisor) with population variance (N divisor).
  • Forgetting that the sample mean is derived from the data, which is why deviations from it are smaller on average than deviations from the population mean.

Animation

Animation coming soon

The animated version of this lesson is being prepared for the web. In the Signals AI app, lessons are drawn step by step.

Code

This is a text lesson: it has no animation code yet.

ccBYNC© 2026 SignalsLab. Lesson text shared as is under CC BY-NC 4.0.