The variance of a Random variable is a measure of its statistical dispersion. It is defined as the Expected value of the square of the deviation from the population mean :
The variance can also be expressed as
Or as the Covariance of a variable with itself
The primary draw of variance as a measure of dispersion is that it is mathematically convenient to use in calculations and to derive results with. For instance, Chebyshev's inequality forces constraints onto what values the variable can take depending on its variance. Furthermore, it is the second central function moment of a probability distribution.
The square root of variance is the standard deviation: . The variance is (approximately) related to the absolute error by .
Definitions#
Discrete random variable#
Given a discrete random variable with Probability mass function of expected value , the variance is
Continuous random variable#
Given a continuous random variable with Probability density function of expected value , the variance is
or equivalently
Multiple variables#
The variance is not defined for multiple variables (see instead Covariance). However, it is possible to find the variance of one variable among many from the joint distribution function.
For continuous random variables with JDF , the variance of is
where is the expected value of .
Sample variance#
By definition, calculating the true variance requires knowing the true mean . This is often not the case, so the true mean must be substituted by (one of) its estimator: the sample mean. For a random sample of independent variables , we can look for the average of the square deviations from the sample mean :
This is known as the sample variance and is an estimator of the true variance. However, in this form, it is imperfect. It is a biased estimator of the true variance . To fix the bias, we apply Bessel's correction (changing to ):
This is the unbiased sample variance and is the appropriate estimator for the true variance in most cases.1 Its expected value is, in fact, .
Properties#
- If are independent variables, the variance of the sum is the sum of the variances: . Also, it is linear with respect to constant scaling: .
Propagation of variance#
It is common for a quantity to be dependent on other quantities according to some function . If we take the variables to be independent of each other, the variance of is expressed by the law of propagation of variance:
For this to work, must be twice-differentiable in all of its arguments. This is a special case (and an approximation nonetheless) of the general properties of functions of random variables.
Footnotes#
-
But not all. Bias is far from the only problem to consider in choosing an estimator. actually has legitimate use cases, as it has lower variance than unbiased , at the cost of missing the mark due to the bias. In fact, if using over causes estimates to go all over the place due to the higher variance, the little gain from removing bias is probably not enough to offset that, so you end up with worse estimates despite using the unbiased estimator. This usually happens when the sample size is small, when adding a bit of bias is often an acceptable price to pay to reduce variance. ↩