Mean square variance is the average of the squared differences between each data point and the mean of the data set. It is the same as the population variance (σ²) when you divide by the number of observations, or the sample variance (s²) when you divide by the number of observations minus one. Enter your data below to compute both the population and sample variance, plus the standard deviation.
in data | Data values (comma separated) | - | 4, 8, 15, 16, 23, 42 | 0 | 100000 out varp | Population variance | - | pvar(data) | 4 out vars | Sample variance | - | var(data) | 4 out sdp | Population std dev | - | psd(data) | 4 out sds | Sample std dev | - | sd(data) | 4
Formula
The mean square variance is computed as the average of squared deviations from the mean. For a population of N values, the formula is:
σ² = Σ(xᵢ − μ)² / N
where xᵢ is each individual value, μ is the population mean, and N is the number of values. For a sample of n values, the formula becomes:
s² = Σ(xᵢ − x̄)² / (n − 1)
where x̄ is the sample mean and n is the sample size. The denominator n − 1 is called Bessel's correction; it makes the sample variance an unbiased estimator of the population variance.
Worked Example
Using the default data set 4, 8, 15, 16, 23, 42, first find the mean:
μ = (4 + 8 + 15 + 16 + 23 + 42) / 6 = 108 / 6 = 18
Now compute each squared deviation:
- (4 − 18)² = (−14)² = 196
- (8 − 18)² = (−10)² = 100
- (15 − 18)² = (−3)² = 9
- (16 − 18)² = (−2)² = 4
- (23 − 18)² = (5)² = 25
- (42 − 18)² = (24)² = 576
Sum of squared deviations = 196 + 100 + 9 + 4 + 25 + 576 = 910
Population variance = 910 / 6 = 151.6667
Sample variance = 910 / (6 − 1) = 910 / 5 = 182
The calculator rounds to 4 decimals, giving 151.6667 and 182.0000 respectively.
Why Squared Deviations?
Squaring the deviations serves two purposes. First, it removes negative signs—if you simply averaged the raw deviations, they would always sum to zero, telling you nothing about spread. Second, squaring gives more weight to outliers. A value far from the mean contributes disproportionately to the variance, which is why variance is sensitive to extreme data points. For example, in the data set above, the value 42 alone accounts for 576 of the 910 total squared deviations, about 63% of the variance.
This sensitivity is both a strength and a weakness. It makes variance useful for detecting outliers, but it can also give a misleading picture if your data has a few extreme values. The standard deviation, which is the square root of variance, brings the measure back to the original units of the data, making it easier to interpret.
Population vs. Sample Variance
The distinction between population and sample variance is crucial. Use population variance when your data includes every member of the group you are studying—for example, the heights of all students in a class of 30. Use sample variance when your data is a random subset of a larger group—for example, the heights of 30 students selected from a school of 1,000.
The denominator difference (N vs. n−1) is not arbitrary. If you used N for a sample, the variance would tend to underestimate the true population variance, especially for small samples. Dividing by n−1 corrects this bias. For large samples (n > 30), the difference between the two becomes negligible.
Common Mistakes and Misconceptions
- Confusing variance with standard deviation: Variance is in squared units (e.g., square dollars, square inches), while standard deviation is in the original units. Always state which one you are reporting.
- Using the wrong denominator: Forgetting to use n−1 for sample variance is a common error. Check whether your data is a full population or a sample.
- Ignoring units: If your data is in feet, variance is in square feet. This is why standard deviation is often preferred for reporting.
- Rounding too early: Rounding intermediate squared deviations can change the final variance noticeably. Keep full precision until the end.
- Assuming variance is always positive: Variance is never negative; it is zero only when all values are identical.
How to Choose the Right Measure
Variance is not always the best measure of spread. Consider these guidelines:
- Use variance or standard deviation when your data is roughly symmetric and you want a measure that uses all data points, especially in statistical tests.
- Use the interquartile range (IQR) when your data has strong outliers or is skewed. The IQR is the difference between the 75th and 25th percentiles and is not affected by extreme values.
- Use the mean absolute deviation (MAD) if you want a measure in the original units that is less sensitive to outliers than standard deviation, though it is less common in statistics.
- Use the range for a quick, rough check, but remember it only uses two values and is highly sensitive to outliers.
For most inferential statistics (t-tests, ANOVA, regression), variance is the foundational measure because it has nice mathematical properties, even if it is less intuitive than standard deviation.
Limitations of Variance
Variance assumes your data is measured on an interval or ratio scale—that is, the distances between values are meaningful. It is not appropriate for ordinal data (like rankings) or nominal data (like categories). For those, you would use other measures of dispersion such as the range or the index of qualitative variation.
Variance is also not robust to outliers. A single extreme value can inflate the variance dramatically, making the data appear more spread out than it really is. If your data has outliers, consider reporting both the variance and a robust measure like the median absolute deviation (MAD).
Finally, variance is not a unitless quantity. Comparing variances across different scales (e.g., height in inches vs. weight in pounds) is meaningless. To compare relative variability, use the coefficient of variation (CV = standard deviation / mean), which is unitless.
Frequently Asked Questions
What is the difference between mean square variance and standard deviation?
Mean square variance is the average of squared deviations from the mean, expressed in squared units. Standard deviation is the square root of that value, bringing it back to the original units. For example, if data is in meters, variance is in square meters, but standard deviation is in meters. Standard deviation is often easier to interpret because it is directly comparable to the mean.
Why do we divide by n−1 for sample variance?
Dividing by n−1 (Bessel's correction) makes the sample variance an unbiased estimator of the population variance. If you divided by n, the sample variance would, on average, be slightly smaller than the true population variance. This is especially important for small samples; as the sample size grows, the difference between n and n−1 becomes negligible.
Can variance be negative?
No, variance is always non-negative. Since you square each deviation, every term is zero or positive. The only way variance is zero is if all data points are identical. If you ever get a negative variance, it indicates a calculation error.
How do I interpret a variance value?
Variance alone is hard to interpret because it is in squared units. For example, a variance of 151.67 for the data set above means the average squared deviation from the mean is 151.67. To get a more intuitive measure, take the square root to get the standard deviation (about 12.32 for the population), which tells you the typical distance of data points from the mean.
What is the relationship between variance and mean square error?
Mean square error (MSE) is similar to variance but measures the average squared difference between predicted values and actual values. In regression, MSE is the variance of the residuals (the differences between observed and predicted values). If the model is unbiased, MSE equals the variance of the errors. Variance measures spread around the mean, while MSE measures spread around a prediction line.