Variance Calculator: Population and Sample Variance
Find the population and sample variance of a data set with the sum of squared deviations, the mean and a table of each value's deviation, free in your browser.
Separate numbers with commas, spaces or new lines.
Variance
- Population variance (σ², divide by n)
- 4
- Sample variance (s², divide by n − 1)
- 4.57142857143
Sum of squared deviations Σ(x − mean)² = 32 over n = 8 values.
Standard deviation
- Population standard deviation (σ, divide by n)
- 2
- Sample standard deviation (s, divide by n − 1)
- 2.1380899353
Sum of squared deviations Σ(x − mean)² = 32 over n = 8 values.
Quartiles and IQR
- First quartile (Q1)
- 4
- Third quartile (Q3)
- 6
- Interquartile range (IQR = Q3 − Q1)
- 2
Exclusive median method (TI-84): Q1 and Q3 are the medians of the lower and upper halves, leaving out the median itself when the count is odd. Spreadsheet functions such as Excel's QUARTILE.INC may give different values.
Z-score
Enter a value x to see how many standard deviations it lies from the mean.
z = (x − mean) / SD.
Summary
- Count (n)
- 8
- Sum
- 40
- Mean
- 5
- Median
- 4.5
- Mode
- 4
- Minimum
- 2
- Maximum
- 9
- Range
- 7
Deviations from the mean
| x | x − mean | (x − mean)² |
|---|---|---|
| 2 | -3 | 9 |
| 4 | -1 | 1 |
| 4 | -1 | 1 |
| 4 | -1 | 1 |
| 5 | 0 | 0 |
| 5 | 0 | 0 |
| 7 | 2 | 4 |
| 9 | 4 | 16 |
Variance Calculator
This page opens with the variance first. Paste a data set and it shows the population variance (divide by n) and the sample variance (divide by n − 1), the sum of squared deviations behind them, and a table of every value's deviation from the mean. The standard deviation, quartiles, z-scores and a summary of the data follow below. The example 2, 4, 4, 4, 5, 5, 7, 9 is filled in so you can see the steps straight away.
What variance measures
Variance is the average squared distance from the mean. A small variance means the values sit close together; a large one means they are spread out. Because each deviation is squared, values far from the mean count for much more than values near it, and the result is in squared units. The square root of the variance is the standard deviation, which is back in the units of the data.
How to calculate variance by hand
Steps
- Add the values and divide by how many there are to get the mean.
- Subtract the mean from each value to get its deviation.
- Square each deviation and add the squares. This total is the sum of squares, SS.
- Divide SS by n for the population variance, or by n − 1 for the sample variance.
Worked example
2, 4, 4, 4, 5, 5, 7, 9
The mean is 40 / 8 = 5. The squared deviations are 9, 1, 1, 1, 0, 0, 4 and 16, so SS = 32. The population variance is 32 / 8 = 4 and the sample variance is 32 / 7 = 4.57142857143.
Population or sample?
Use the population variance when your list is the entire group, for example the heights of every player on one team. Use the sample variance when the list is a sample used to estimate a bigger group. Dividing by n − 1 instead of n makes the sample variance an unbiased estimate. With a single value the sample variance has no meaning, and the page says "Needs at least 2 values".
Precision
The calculator finds the mean first and then sums the squared deviations. This two-pass method keeps large values accurate: for 1,000,000,004, 1,000,000,007, 1,000,000,013 and 1,000,000,016 the sample variance is exactly 30 and the population variance 22.5. Values must lie between -1e150 and 1e150 so that their squares stay finite.
Privacy
Nothing is uploaded; every calculation runs in your browser and never leaves your device.
Related tools
The Standard Deviation Calculator opens the same tool with the standard deviation first. For a plain summary of a list, use the Number List Calculator.
Frequently asked questions
What is variance?
Variance is the average squared distance of the values from their mean. It is the square of the standard deviation, so it is measured in squared units. For 2, 4, 4, 4, 5, 5, 7, 9 the population variance is 4.
What is the difference between population and sample variance?
Population variance divides the sum of squared deviations by n. Sample variance divides by n − 1, which corrects for estimating the mean from the same sample. For the example data they are 4 and 4.57142857143.
How do I calculate the sum of squares?
Subtract the mean from each value, square each result and add them up. The deviation table on this page shows each step, and the total is printed under the variance.
Why is variance in squared units?
Each deviation is squared before averaging, so if the data are in metres, the variance is in square metres. Take the square root, the standard deviation, to get back to the original units.
Why does the calculator use two passes?
It finds the mean first and then sums (x − mean)². The shortcut Σx² − (Σx)²/n loses precision for large values such as 1,000,000,004, while the two-pass method still gives the exact sample variance of 30 for the four values in the example on this page.