Loading AI tools

Statistical measure of how far values spread from their average From Wikipedia, the free encyclopedia

In probability theory and statistics, **variance** is the expected value of the squared deviation from the mean of a random variable. The standard deviation (SD) is obtained as the square root of the variance. Variance is a measure of dispersion, meaning it is a measure of how far a set of numbers is spread out from their average value. It is the second central moment of a distribution, and the covariance of the random variable with itself, and it is often represented by , , , , or .^{[1]}

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.

The variance of a random variable is the expected value of the squared deviation from the mean of , :

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.

If the generator of random variable is discrete with probability mass function , then

where is the expected value. That is,

(When such a discrete weighted variance is specified by weights whose sum is not 1, 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]}

If the random variable has a probability density function , and is the corresponding cumulative distribution function, then

or equivalently,

where is the expected value of given by

In these formulas, the integrals with respect to and are Lebesgue and Lebesgue–Stieltjes integrals, respectively.

If the function is Riemann-integrable on every finite interval then

where the integral is an improper Riemann integral.

The exponential distribution with parameter λ is a continuous distribution whose probability density function is given by

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

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

The following table lists the variance for some commonly used probability distributions.

Name of the probability distribution | Probability distribution function | Mean | Variance |
---|---|---|---|

Binomial distribution | |||

Geometric distribution | |||

Normal distribution | |||

Uniform distribution (continuous) | |||

Exponential distribution | |||

Poisson distribution |

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:

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

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* of the random variable *Y*, there is a conditional expectation given the event *Y* = *y*. This quantity depends on the particular value *y*; 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