Variance Calculator: Sample & Population, With Steps
Variance measures spread: it's roughly the average squared distance from the mean (exactly, for a population). For 2, 4, 4, 4, 5, 5, 7, 9 the squared deviations add up to 32, so the population variance is 32 ÷ 8 = 4 and the sample variance is 32 ÷ 7 ≈ 4.5714.
- Sample & population
- Every step
- Paste a column
- Mean5
- Sum of squared deviations32
- Population (÷ 8)4
- Population SD (√4)2
To calculate variance, find the mean, subtract it from each value, square each difference, add the squares and divide. Divide by n − 1 when your data are a sample from a larger group, or by N when they're the whole population. For 2, 4, 4, 4, 5, 5, 7, 9 the mean is 5 and the squared deviations sum to 32, so the sample variance is 32 ÷ 7 ≈ 4.5714 and the population variance is 4. This variance calculator shows each of those steps and the standard deviation that goes with them.
How to Calculate Variance
- Find the mean: (2 + 4 + 4 + 4 + 5 + 5 + 7 + 9) ÷ 8 = 40 ÷ 8 = 5.
- Subtract the mean from each value: −3, −1, −1, −1, 0, 0, 2, 4.
- Square each deviation: 9, 1, 1, 1, 0, 0, 4, 16.
- Add the squares: 9 + 1 + 1 + 1 + 0 + 0 + 4 + 16 = 32, the sum of squares.
- Divide: by n − 1 = 7 for the sample variance (32 ÷ 7 ≈ 4.5714), or by N = 8 for the population variance (32 ÷ 8 = 4).
The sample formula, s² = Σ(x − x̄)² ÷ (n − 1), is the one in NIST's engineering statistics handbook (NIST/SEMATECH e-Handbook, 1.3.5.6). OpenStax divides by N only when the data are the entire population, such as a census (OpenStax Introductory Statistics 2e, 2.7).
Sample vs Population Variance
| Sample variance | Population variance | |
|---|---|---|
| Symbol | s² | σ² |
| Divide the sum of squares by | n − 1 | N |
| Use when | Your data are a sample from a bigger group | Your data are every member of the group |
| 2, 4, 4, 4, 5, 5, 7, 9 | 32 ÷ 7 ≈ 4.5714 | 32 ÷ 8 = 4 |
The sample variance is always n ÷ (n − 1) times the population variance: 8 ÷ 7 ≈ 1.14 times here. With a large data set the two are almost the same. Why the difference? The sample variance is an estimate of the population's variance, and OpenStax notes that dividing by n − 1 gives a better estimate of it (OpenStax, 2.7).
In Excel, VAR.S gives the sample variance and VAR.P the population variance (Microsoft Support, VAR.S function).
Variance and Standard Deviation
The standard deviation is the square root of the variance (NIST, 1.3.5.6), so a population variance of 4 means a standard deviation of 2. Variance is in squared units (for heights in centimeters, square centimeters), which is why the standard deviation, back in the data's own units, is easier to read. For more on it, including z-scores, see the standard deviation calculator.
Frequently Asked Questions
Why does sample variance divide by n − 1?
Because a sample is used to estimate the variance of the whole group, and dividing by n − 1 instead of n gives a better estimate (OpenStax, 2.7).
What does a large or small variance mean?
A small variance means the values sit close to the mean; a large one means they're spread out. Because it's in squared units, compare variances only between data measured in the same units.
Should I use sample or population variance?
Use the sample variance unless your numbers include every member of the group you're describing. A class's test scores used to describe that class are a population; a survey of 500 voters used to describe all voters is a sample.
Can variance be negative?
No. It's built from squared distances, which can't be negative, so it's 0 when every value is the same and positive otherwise.
How do I get the standard deviation from the variance?
Take the square root: a variance of 25 gives a standard deviation of 5.
More tools: the mean absolute deviation calculator, the z-score calculator, the mean, median, mode calculator and all the math calculators.