Variance
calculator.
Variance measures how far your numbers spread around their mean, in squared units.
| # | Value |
|---|---|
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 |
- Standard deviation s
- 9.4663
- Sum of squares
- 806.5
- Mean
- 80.5
Values typically sit about 9.4663 from the mean of 80.5, and the variance is that distance squared. 65 carries the most, at 29.8% of the sum of squares.
Spread around the mean
10 observations from 65 to 95. The mean is 80.5, and one standard deviation either side covers 71.0337 to 89.9663.
Working
- 1Add the values, then divide by how many there arex̄ =80510= 80.5
- 2Square each distance from the mean(78 − 80.5)² = 6.25, (82 − 80.5)² = 2.25, (91 − 80.5)² = 110.25, and so on
- 3Add the squares to get the sum of squaresSS = Σ(x − x̄)² = 806.5
- 4Divide by n − 1 for a sample (Bessel's correction)s² =806.59= 89.6111
- 5Take the square root for the standard deviations = √89.6111 = 9.4663
- 6Check: the shortcut formula gives the same sum of squaresΣx² −(Σx)²n= 65,609 −648,02510= 806.5
Where the sum of squares comes from
Each bar is one value's squared distance from the mean, times its count, from the smallest value on the left to the largest on the right. The bars add up to 806.5.
- Value 65
- 240.25
- Share of the sum of squares
- 29.8%
Which value moves the answer most
Each row drops one observation and recalculates s² from the rest.
- Drop 65
- s² = 67.4444 (−22.1667)
- Drop 95
- s² = 71.6111 (−18)
- Drop 82
- s² = 100.5 (+10.8889)
- Drop 79
- s² = 100.5 (+10.8889)
- Drop 78
- s² = 99.9444 (+10.3333)
Interval for the true variance
- 95% interval for σ²
- 42.3966 to 298.6606
- 95% interval for σ
- 6.5113 to 17.2818
This uses the chi-square distribution and assumes the data come from a normal distribution. Skewed data or outliers can make it badly wrong.
Sample or population
With 10 values, s² is 1.111 times σ². The gap shrinks as the data grow.
Deviation table
| 78x − x̄ −2.5z (pop.) −0.278 | −2.5 | 6.25 | −0.278 | 0.8% |
|---|---|---|---|---|
| 82x − x̄ +1.5z (pop.) 0.167 | +1.5 | 2.25 | 0.167 | 0.3% |
| 91x − x̄ +10.5z (pop.) 1.169 | +10.5 | 110.25 | 1.169 | 13.7% |
| 65x − x̄ −15.5z (pop.) −1.726 | −15.5 | 240.25 | −1.726 | 29.8% |
| 88x − x̄ +7.5z (pop.) 0.835 | +7.5 | 56.25 | 0.835 | 7% |
How it's worked out
Take each value's distance from the mean, square it, and add the squares. That total is the sum of squares, SS. NIST defines the sample variance as SS over n − 1. When your data are the whole group, you divide by n instead.
Here x is each value, or is the mean, and n is how many values you have. Squaring makes every distance positive and gives far values extra weight. It also squares the unit, so scores in points give a variance in square points.
Why a sample divides by n − 1
This is Bessel's correction. Distances from a sample's own mean run a little small, because that mean sits right in the middle of those values. On average the n version comes out at of the true variance, and dividing by n − 1 removes that gap. With just 4 and 8, SS is 8, so σ² is 4 and s² is 8. With 100 values, s² is only 1.01 times σ².
From a frequency table
When you have counts instead of a list, multiply each squared distance by its count. Then n is the total of the counts, and the answer is the same as typing out every repeat.
The shortcut formula
Older textbooks use this version, which saves working out each distance by hand.
It is exact on paper. On a computer it subtracts two nearly equal totals and can lose its digits. Take 4, 7, 13 and 16, each with 1,000,000,000 added. The true SS is 90, yet the shortcut returns 0 here. So this tool works from the distances, and uses the shortcut only as a check. Its engine is tested against NIST's certified results for values this close together.
Worked examples
Ten exam scores, as a sample
A teacher takes ten scores from a large year group. They add up to 805, so the mean is 80.5. The squared distances total SS = 806.5. Dividing by 9 gives s² = 89.61 square points, and the square root gives s = 9.47 points.
Two scores carry over half of that. The 65 makes up 29.8% of SS and the 95 makes up 26.1%. Drop the 65 and s² falls to 67.44. The 95% interval for the true variance runs from 42.4 to 298.66, which is wide for ten values.
30 survey ratings in a frequency table
A survey asks 30 people to rate a product from 1 to 5, and the counts are 3, 7, 12, 6 and 2. Weighting by count gives a mean of 2.9 and SS = 32.7. Dividing by 29 gives s² = 1.128, and the square root gives s = 1.062.
The same 30 ratings typed as a list give the same result, because a count is only a short way to write repeats. A rating scale has no real unit, so read this variance as a measure of how much people disagreed.
Five commutes, as a whole population
A five-person team compares one-way commutes of 12, 25, 18, 40 and 15 minutes. These five people are the whole group of interest, so divide by n. The mean is 22 minutes and σ² = 99.6 square minutes, or σ = 9.98 minutes.
The 40-minute trip alone makes up 65.1% of SS. Without it, σ² is 23.25, less than a quarter of the figure with it. A far value counts more than its share because its distance is squared.
Reading your result
Read it with its square root. The variance is in squared units, so the standard deviation brings the spread back to the units of your data. An s² of 89.61 square points means s = 9.47 points, and that is the number to compare with the scores.
Look at which value carries it. A value twice as far from the mean adds four times as much to SS, so one far value can dominate. NIST warns that variance can be greatly affected by the tails of the data. Check the shares and the drop-one list before you trust a large figure.
Use it where it adds up. Spread in squared units has one property the standard deviation lacks: the variance of a sum of uncorrelated quantities is the sum of their variances. Multiplying a quantity by a constant multiplies its variance by that constant squared, and adding a constant changes nothing.
How far a sample pins down the true variance
With data from a normal distribution, a chi-square interval gives a range for σ². Each bound divides SS by a chi-square value with n − 1 degrees of freedom, one from each tail.
| Sample size n | Lower | Upper |
|---|---|---|
| 5 | 0.359 | 8.257 |
| 10 | 0.473 | 3.333 |
| 20 | 0.578 | 2.133 |
| 50 | 0.698 | 1.553 |
| 100 | 0.771 | 1.349 |
| 500 | 0.887 | 1.137 |
Variances are hard to estimate from small samples. With five values, the true variance could plausibly run from 0.36 times s² to 8.26 times it.
The other figures
- Standard error of the mean is s divided by the square root of n. It measures how precisely you know the mean, not how spread out the data are.
- Coefficient of variation is s divided by the size of the mean. It compares spread across different scales, and it only makes sense for data with a meaningful zero, such as weights or prices.
- [Skewness](https://www.itl.nist.gov/div898/handbook/eda/section3/eda35b.htm) is the third moment about the mean divided by σ cubed. A positive value means a longer right tail, and a negative one means a longer left tail.
Common mistakes
- Using the population formula on a sample. It always comes out smaller, and with five values s² is 1.25 times σ². Most real data sets are samples. Excel keeps the two apart as VAR.S and VAR.P.
- Comparing the variance with the data. Squared units do not line up with the original ones. Daily returns averaging 0.93% have s² = 2.12, and 0.2, 0.3, 0.4 and 0.5 have s² = 0.0167, far below every value in the list. Compare s with the data instead.
- Rounding the mean too soon. Squaring a rounded distance carries the error into every row. If you work by hand, keep extra digits until the last step.
- Trusting the interval on skewed data. The chi-square method is extremely sensitive to departures from normality. Treat the interval as a rough guide unless the data look bell-shaped.
Questions people ask
Sources
- NIST/SEMATECH e-Handbook, section 1.3.5.6, Measures of Scale
- NIST/SEMATECH e-Handbook, section 1.3.5.8, Chi-Square Test for the Variance
- NIST/SEMATECH e-Handbook, section 1.3.5.11, Measures of Skewness and Kurtosis
- NIST Statistical Reference Datasets, NumAcc1 certified values
- Wikipedia, Bessel's correction
- Wikipedia, Algorithms for calculating variance
- Wikipedia, Variance
- EnvStats documentation, varTest
- NumPy documentation, numpy.var
- pandas documentation, Series.var
- Wikipedia, Coefficient of variation
- Microsoft Support, VAR.S function
- Real Statistics Using Excel, Frequency Tables
- The Math Doctors, Standard Deviation and Its Rivals