Variance
Variance measures how spread out a set of values is. You’ll rarely report it as a descriptive statistic, because its units are awkward. But it’s one of the most important quantities in statistics: ANOVA, regression and R² are all built from it.
The formula
s² = Σ(x − x̄)² / (n − 1)
- Find the mean, x̄.
- Subtract it from each value to get the deviations.
- Square each deviation.
- Add the squares (this is the “sum of squares”, SS).
- Divide by n − 1.
Worked example
Five quiz scores: 4, 6, 7, 8, 10.
| Score (x) | x − x̄ | (x − x̄)² |
|---|---|---|
| 4 | −3 | 9 |
| 6 | −1 | 1 |
| 7 | 0 | 0 |
| 8 | 1 | 1 |
| 10 | 3 | 9 |
| Sum | 0 | 20 |
The mean is 7. The deviations always sum to zero, which is why we square them. The sum of squares is 20, so the variance is 20 / (5 − 1) = 5, and the standard deviation is √5 ≈ 2.24.
Why square the deviations?
- Positive and negative deviations would otherwise cancel out to zero every time.
- Squares have convenient mathematical properties. In particular, variances of independent sources add up, which is what lets ANOVA and regression split variation into parts.
- The trade-off: squaring gives large deviations extra weight, so variance is sensitive to outliers.
Why n − 1?
A sample’s values sit a little closer to their own mean than to the true population mean, so the squared deviations come out slightly too small. Dividing by n − 1 instead of n corrects this, and makes the sample variance an unbiased estimate of the population variance (σ²). Divide by n only when your data are the entire population. The n − 1 is also an example of degrees of freedom.
Variance vs standard deviation
They carry the same information: the SD is the square root of the variance. The difference is units. Fuel economy for the 32 cars in R’s mtcars data has a variance of 36.32 squared miles per gallon, which means little. Its SD of 6.03 mpg is immediately interpretable. Report the standard deviation when describing data. Variance shows up in the calculations.
Where variance does the work
- ANOVA compares variance between groups with variance within groups. That ratio is the F statistic. See one-way ANOVA.
- R² is the proportion of the outcome’s variance a regression model explains. See R-squared.
- The equal-variances assumption of t-tests and ANOVA is about whether groups have similar variances. See homogeneity of variance.
- Standard errors come from variance: SE = √(s² / n).
In software
- Excel:
VAR.S(sample) orVAR.P(population). - R:
var(x), which uses n − 1. - Python:
numpy.var(x, ddof=1). NumPy divides by n unless you setddof=1.pandasuses n − 1 by default.
More in Descriptive statistics
Try it with the free tools
Run this on your own data
Upload a dataset and ask your question in plain English. Analytika checks the assumptions, picks the test, runs it, and writes the results up in APA format.