General calculator
Variance Calculator
Free online variance calculator. Quickly compute sample and population variance, mean, and standard deviation for any set of numbers with step-by-step math.
Introduction
Variance is a core statistical measurement that determines the spread or dispersion of data points around their mathematical mean. Our Variance Calculator is a powerful, free online tool that calculates both sample variance and population variance, along with related metrics like standard deviation, mean, and sum of squares. Simply enter your numbers separated by commas, spaces, or newlines, select your study type, and see your results instantly.
How to Use
To use the Variance Calculator, enter your dataset as a list of numbers separated by commas, spaces, or newlines. Select the type of variance you want to calculate: "Sample" (if your data is a subset of a larger group) or "Population" (if your data covers every member of the group). Click "Calculate" to generate the results, which include the variance, standard deviation, mean, total count, sum, and sum of squared differences.
Formula
Population Variance formula: σ² = Σ(xi - μ)² / N, where μ is the population mean and N is the total population size. Sample Variance formula: s² = Σ(xi - x̄)² / (n - 1), where x̄ is the sample mean and n is the sample size. The use of (n - 1) in sample variance is known as Bessel's correction, which yields an unbiased estimator of population variance.
Examples
Example: Let's calculate variance for [2, 4, 4, 4, 5, 5, 7, 9]. (1) Count = 8. (2) Sum = 40. (3) Mean = 40/8 = 5. (4) Sum of Squares = (2-5)² + 3×(4-5)² + 2×(5-5)² + (7-5)² + (9-5)² = 9 + 3 + 0 + 4 + 16 = 32. (5) Population Variance = 32 / 8 = 4.0. (6) Sample Variance = 32 / 7 = 4.5714.
Results Explained
The results show: (1) Variance: the average squared deviation from the mean. (2) Standard Deviation: the square root of the variance, expressing spread in the original data units. (3) Mean: the arithmetic average of the numbers. (4) Sum of Squares: the sum of the squared differences from the mean.
Related Calculators
What is Variance in Statistics?
In statistics and probability theory, variance measures how far a set of numbers is spread out from their average value. A variance of zero indicates that all values within the dataset are identical. A small variance indicates that the data points tend to be very close to the mean, while a high variance indicates that the data points are highly spread out from the mean and from one another.
Unlike simple range (the difference between the maximum and minimum values), variance takes into account every single data point in the set. It does this by measuring the difference between each number and the mean, squaring that difference (to ensure negative and positive differences do not cancel each other out), and then averaging those squared differences.
Sample vs. Population Variance
One of the most important distinctions in statistics is whether your data represents a **sample** or a **population**:
- Population Variance (σ²): Calculated when you have collected data from every individual member of the group you are studying. For example, if you want to know the variance of test scores for a class of 20 students, and you have the scores of all 20 students, you calculate the population variance. The denominator in this formula is the total count, N.
- Sample Variance (s²): Calculated when your data is a representative subset of a larger population. For example, if you want to estimate the variance of test scores for all high school students in a city, but you only have data for a sample of 100 students, you calculate the sample variance. The denominator in this formula is n - 1.
Why Do We Divide by n - 1? (Bessel's Correction)
When calculating sample variance, dividing by n rather than n - 1 tends to underestimate the true variance of the population. This is because the sample is likely to be slightly less spread out than the entire population. To correct this bias, statisticians use **Bessel's correction**, dividing by n - 1 instead of n. The term n - 1 represents the **degrees of freedom** in the dataset—the number of values that are free to vary after the sample mean has been calculated.
Step-by-Step Calculation Guide
To calculate sample variance by hand, follow these steps:
- Calculate the Mean: Add all numbers together and divide by the count (n).
- Find the Deviations: Subtract the mean from each individual number in the dataset.
- Square the Deviations: Multiply each deviation by itself.
- Sum the Squares (SS): Add all of the squared deviations together.
- Divide: Divide this sum of squares by n - 1 for a sample variance, or by N for a population variance.
Three Detailed Worked Examples
Example 1: Sample Variance of Daily Sales
A small business owner wants to check the variance of daily sales over 5 days: $10, $15, $20, $12, and $18.
1. Find the mean: (10 + 15 + 20 + 12 + 18) / 5 = 75 / 5 = $15.
2. Subtract mean and square the results:
(10 - 15)² = (-5)² = 25
(15 - 15)² = 0² = 0
(20 - 15)² = 5² = 25
(12 - 15)² = (-3)² = 9
(18 - 15)² = 3² = 9
3. Sum of Squares (SS) = 25 + 0 + 25 + 9 + 9 = 68.
4. Calculate sample variance: s² = 68 / (5 - 1) = 68 / 4 = 17.
The sample variance is 17.00 (squared dollars).
Example 2: Population Variance of a Family's Ages
Let's find the population variance of the ages of four family members: 10, 12, 40, and 42.
1. Find the mean: (10 + 12 + 40 + 42) / 4 = 104 / 4 = 26 years.
2. Subtract mean and square:
(10 - 26)² = (-16)² = 256
(12 - 26)² = (-14)² = 196
(40 - 26)² = 14² = 196
(42 - 26)² = 16² = 256
3. Sum of Squares = 256 + 196 + 196 + 256 = 904.
4. Calculate population variance: σ² = 904 / 4 = 226.
The population variance is 226.00 (squared years).
Example 3: Comparing Variance of Stock Returns
A financial advisor compares two stock portfolios over 3 years. Portfolio A returns: 2%, 5%, 8%. Portfolio B returns: -1%, 5%, 11%.
Both portfolios have an average return of 5% [(2+5+8)/3 = 5% and (-1+5+11)/3 = 5%]. Let's calculate their sample variances:
- Portfolio A SS = (2-5)² + (5-5)² + (8-5)² = 9 + 0 + 9 = 18. Variance = 18 / 2 = 9.
- Portfolio B SS = (-1-5)² + (5-5)² + (11-5)² = 36 + 0 + 36 = 72. Variance = 72 / 2 = 36.
Portfolio B has four times the variance of Portfolio A, indicating it is a much higher-risk investment.
Frequently Asked Questions
What is variance?
Variance is a statistical measurement of the spread between numbers in a data set. Specifically, it measures how far each number in the set is from the mean.
What is the difference between sample and population variance?
Population variance is used when you have the complete dataset for the entire group. Sample variance is used when your data represents a sample of a larger population. Sample variance divides by n-1 to correct for bias, while population variance divides by N.
Why is variance squared?
We square the differences to eliminate negative values (which would otherwise cancel out positive differences when summed) and to give greater weight to extreme outliers.
What is Bessel's correction?
Bessel's correction is the use of n-1 instead of n in the denominator of the sample variance and sample standard deviation formulas, correcting the tendency of samples to underestimate population variance.
What is standard deviation?
Standard deviation is the square root of the variance. It measures the spread of data in the same units as the original data, whereas variance is measured in squared units.
Can variance be negative?
No. Because variance is calculated by summing squared differences (which are always positive or zero) and dividing by a positive number, the result can never be negative.
What does a variance of zero mean?
A variance of zero means all numbers in the dataset are identical, indicating there is absolutely no variation or dispersion.
How do you calculate variance by hand?
Find the mean of the data, subtract the mean from each value, square each difference, sum the squared differences, and divide by the number of values (or values minus one for a sample).
What is Sum of Squares (SS)?
Sum of Squares is the sum of the squared deviations of data points from their mean. It represents the total variation before dividing by the degrees of freedom.
Does variance have units?
Yes, variance has squared units. If your data is in meters, the variance is in square meters. Standard deviation is preferred for general descriptions because it returns to the original units (meters).
How do outliers affect variance?
Because the differences from the mean are squared, outliers (values very far from the mean) have a disproportionately large impact, raising the variance significantly.
What is a degree of freedom in variance?
In sample variance, the degrees of freedom is n-1, indicating the number of independent data points available to estimate the variance after calculating the sample mean.
Is variance used in finance?
Yes, in finance, variance (and standard deviation) represents the volatility of an asset's return, which is a key measure of investment risk.
Can you calculate variance for qualitative data?
No. Variance is a numerical measure of spread and can only be calculated for quantitative (numerical) data.
How is variance different from covariance?
Variance measures the spread of a single variable, while covariance measures how two variables change together (their joint variability).