An advantage of variance as a measure of dispersion is that it is more amenable to algebraic manipulation than other measures of dispersion such as the expected absolute deviation; for example, the variance of a sum of uncorrelated random variables is equal to the sum of their variances. A disadvantage of the variance for practical applications is that, unlike the standard deviation, its units differ from the random variable, which is why the standard deviation is more commonly reported as a measure of dispersion once the calculation is finished. Another disadvantage is that the variance is not finite for many distributions.
There are two distinct concepts that are both called "variance". One, as discussed above, is part of a theoretical probability distribution and is defined by an equation. The other variance is a characteristic of a set of observations. When variance is calculated from observations, those observations are typically measured from a real-world system. If all possible observations of the system are present, then the calculated variance is called the population variance. Normally, however, only a subset is available, and the variance calculated from this is called the sample variance. The variance calculated from a sample is considered an estimate of the full population variance. There are multiple ways to calculate an estimate of the population variance, as discussed in the section below.
The two kinds of variance are closely related. To see how, consider that a theoretical probability distribution can be used as a generator of hypothetical observations. If an infinite number of observations are generated using a distribution, then the sample variance calculated from that infinite set will match the value calculated using the distribution's equation for variance. Variance has a central role in statistics, where some ideas that use it include descriptive statistics, statistical inference, hypothesis testing, goodness of fit, and Monte Carlo sampling.
This definition encompasses random variables that are generated by processes that are discrete, continuous, neither, or mixed. The variance can also be thought of as the covariance of a random variable with itself:
The variance is also equivalent to the second cumulant of a probability distribution that generates . The variance is typically designated as , or sometimes as or , or symbolically as or simply (pronounced "sigma squared"). The expression for the variance can be expanded as follows:
In other words, the variance of X is equal to the mean of the square of X minus the square of the mean of X. This equation should not be used for computations using floating point arithmetic, because it suffers from catastrophic cancellation if the two components of the equation are similar in magnitude. For other numerically stable alternatives, see Algorithms for calculating variance.
(When such a discrete weighted variance is specified by weights whose sum is not1, then one divides by the sum of the weights.)
The variance of a collection of equally likely values can be written as
where is the average value. That is,
The variance of a set of equally likely values can be equivalently expressed, without directly referring to the mean, in terms of squared deviations of all pairwise squared distances of points from each other:[2]
on the interval [0, ∞). Its mean can be shown to be
Using integration by parts and making use of the expected value already calculated, we have:
Thus, the variance of X is given by
Fair die
A fair six-sided die can be modeled as a discrete random variable, X, with outcomes 1 through 6, each with equal probability 1/6. The expected value of X is Therefore, the variance of X is
The general formula for the variance of the outcome, X, of an n-sided die is
Commonly used probability distributions
The following table lists the variance for some commonly used probability distributions.
Variance is non-negative because the squares are positive or zero:
The variance of a constant is zero.
Conversely, if the variance of a random variable is 0, then it is almost surely a constant. That is, it always has the same value:
Issues of finiteness
If a distribution does not have a finite expected value, as is the case for the Cauchy distribution, then the variance cannot be finite either. However, some distributions may not have a finite variance, despite their expected value being finite. An example is a Pareto distribution whose index satisfies
Decomposition
The general formula for variance decomposition or the law of total variance is: If and are two random variables, and the variance of exists, then
The conditional expectation of given , and the conditional variance may be understood as follows. Given any particular value y ofthe random variableY, there is a conditional expectation given the eventY=y. This quantity depends on the particular valuey; it is a function . That same function evaluated at the random variable Y is the conditional expectation
In particular, if is a discrete random variable assuming possible values with corresponding probabilities , then in the formula for total variance, the first term on the right-hand side becomes
where . Similarly, the second term on the right-hand side becomes
where and . Thus the total variance is given by
A similar formula is applied in analysis of variance, where the corresponding formula is
here refers to the Mean of the Squares. In linear regression analysis the corresponding formula is