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.

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.

Etymology

The term variance was first introduced by

The Correlation Between Relatives on the Supposition of Mendelian Inheritance:^{[2]}

The variance is also equivalent to the second cumulant of a probability distribution that generates $X$. The variance is typically designated as $\operatorname {Var} (X)$, or sometimes as $V(X)$ or $\mathbb {V} (X)$, or symbolically as $\sigma _{X}^{2}$ or simply $\sigma ^{2}$ (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

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 $(1+2+3+4+5+6)/6=7/2.$ Therefore, the variance of X is

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$k$ satisfies $1<k\leq 2.$

Decomposition

The general formula for variance decomposition or the law of total variance is: If $X$ and $Y$ are two random variables, and the variance of $X$ exists, then

The conditional expectation$\operatorname {E} (X\mid Y)$ of $X$ given $Y$, and the conditional variance$\operatorname {Var} (X\mid Y)$ may be understood as follows. Given any particular value y of the random variable Y, there is a conditional expectation $\operatorname {E} (X\mid Y=y)$ given the event Y = y. This quantity depends on the particular value y; it is a function $g(y)=\operatorname {E} (X\mid Y=y)$. That same function evaluated at the random variable Y is the conditional expectation $\operatorname {E} (X\mid Y)=g(Y).$

In particular, if $Y$ is a discrete random variable assuming possible values $y_{1},y_{2},y_{3}\ldots$ with corresponding probabilities $p_{1},p_{2},p_{3}\ldots ,$, then in the formula for total variance, the first term on the right-hand side becomes

This can also be derived from the additivity of variances, since the total (observed) score is the sum of the predicted score and the error score, where the latter two are uncorrelated.

Similar decompositions are possible for the sum of squared deviations (sum of squares, ${\mathit {SS}}$):

This expression can be used to calculate the variance in situations where the CDF, but not the density, can be conveniently expressed.

Characteristic property

The second moment of a random variable attains the minimum value when taken around the first moment (i.e., mean) of the random variable, i.e. $\mathrm {argmin} _{m}\,\mathrm {E} \left(\left(X-m\right)^{2}\right)=\mathrm {E} (X)$. Conversely, if a continuous function $\varphi$ satisfies $\mathrm {argmin} _{m}\,\mathrm {E} (\varphi (X-m))=\mathrm {E} (X)$ for all random variables X, then it is necessarily of the form $\varphi (x)=ax^{2}+b$, where a > 0. This also holds in the multidimensional case.^{[4]}

Units of measurement

Unlike the

root mean square deviation

is often preferred over using the variance. In the dice example the standard deviation is √2.9 ≈ 1.7, slightly larger than the expected absolute deviation of 1.5.

The standard deviation and the expected absolute deviation can both be used as an indicator of the "spread" of a distribution. The standard deviation is more amenable to algebraic manipulation than the expected absolute deviation, and, together with variance and its generalization

Variance is invariant with respect to changes in a location parameter. That is, if a constant is added to all values of the variable, the variance is unchanged:

then they are said to be uncorrelated. It follows immediately from the expression given earlier that if the random variables $X_{1},\dots ,X_{N}$ are uncorrelated, then the variance of their sum is equal to the sum of their variances, or, expressed symbolically:

Since independent random variables are always uncorrelated (see Covariance § Uncorrelatedness and independence), the equation above holds in particular when the random variables $X_{1},\dots ,X_{n}$ are independent. Thus, independence is sufficient but not necessary for the variance of the sum to equal the sum of the variances.

Matrix notation for the variance of a linear combination

Define $X$ as a column vector of $n$ random variables $X_{1},\ldots ,X_{n}$, and $c$ as a column vector of $n$ scalars $c_{1},\ldots ,c_{n}$. Therefore, $c^{\mathsf {T}}X$ is a linear combination of these random variables, where $c^{\mathsf {T}}$ denotes the transpose of $c$. Also let $\Sigma$ be the covariance matrix of $X$. The variance of $c^{\mathsf {T}}X$ is then given by:^{[5]}

, but being uncorrelated suffices. So if all the variables have the same variance σ^{2}, then, since division by n is a linear transformation, this formula immediately implies that the variance of their mean is

(Note: The second equality comes from the fact that Cov(X_{i},X_{i}) = Var(X_{i}).)

Here, $\operatorname {Cov} (\cdot ,\cdot )$ is the covariance, which is zero for independent random variables (if it exists). The formula states that the variance of a sum is equal to the sum of all elements in the covariance matrix of the components. The next expression states equivalently that the variance of the sum is the sum of the diagonal of covariance matrix plus two times the sum of its upper triangular elements (or its lower triangular elements); this emphasizes that the covariance matrix is symmetric. This formula is used in the theory of Cronbach's alpha in classical test theory.

So if the variables have equal variance σ^{2} and the average correlation of distinct variables is ρ, then the variance of their mean is

This implies that the variance of the mean increases with the average of the correlations. In other words, additional correlated observations are not as effective as additional independent observations at reducing the uncertainty of the mean. Moreover, if the variables have unit variance, for example if they are standardized, then this simplifies to

This formula is used in the Spearman–Brown prediction formula of classical test theory. This converges to ρ if n goes to infinity, provided that the average correlation remains constant or converges too. So for the variance of the mean of standardized variables with equal correlations or converging average correlation we have

Therefore, the variance of the mean of a large number of standardized variables is approximately equal to their average correlation. This makes clear that the sample mean of correlated variables does not generally converge to the population mean, even though the law of large numbers states that the sample mean will converge for independent variables.

Sum of uncorrelated variables with random sample size

There are cases when a sample is taken without knowing, in advance, how many observations will be acceptable according to some criterion. In such cases, the sample size N is a random variable whose variation adds to the variation of X, such that,

If N has a Poisson distribution, then $\operatorname {E} [N]=\operatorname {Var} (N)$ with estimator N = n. So, the estimator of $\operatorname {Var} \left(\sum _{i=1}^{n}X_{i}\right)$ becomes $n{S_{x}}^{2}+n{\bar {X}}^{2}$ giving $\operatorname {SE} ({\bar {X}})={\sqrt {\frac {{S_{x}}^{2}+{\bar {X}}^{2}}{n}}}$

This implies that in a weighted sum of variables, the variable with the largest weight will have a disproportionally large weight in the variance of the total. For example, if X and Y are uncorrelated and the weight of X is two times the weight of Y, then the weight of the variance of X will be four times the weight of the variance of Y.

The expression above can be extended to a weighted sum of multiple variables:

Real-world observations such as the measurements of yesterday's rain throughout the day typically cannot be complete sets of all possible observations that could be made. As such, the variance calculated from the finite set will in general not match the variance that would have been calculated from the full population of possible observations. This means that one

observations drawn without observational bias from the whole population

squared deviations about the (sample) mean, by dividing by n. However, using values other than n improves the estimator in various ways. Four common values for the denominator are n,n − 1, n + 1, and n − 1.5: n is the simplest (population variance of the sample), n − 1 eliminates bias, n + 1 minimizes mean squared error for the normal distribution, and n − 1.5 mostly eliminates bias in unbiased estimation of standard deviation

biased estimator: it underestimates the variance by a factor of (n − 1) / n; correcting by this factor (dividing by n − 1 instead of n) is called Bessel's correction

The population variance matches the variance of the generating probability distribution. In this sense, the concept of population can be extended to continuous random variables with infinite populations.

Sample variance

See also:

Sample standard deviation

Biased sample variance

In many practical situations, the true variance of a population is not known a priori and must be computed somehow. When dealing with extremely large populations, it is not possible to count every object in the population, so the computation must be performed on a

The unbiased sample variance is a U-statistic for the function ƒ(y_{1}, y_{2}) = (y_{1} − y_{2})^{2}/2, meaning that it is obtained by averaging a 2-sample statistic over 2-element subsets of the population.

Distribution of the sample variance

Distribution and cumulative distribution of S^{2}/σ^{2}, for various values of ν = n − 1, when the y_{i} are independent normally distributed.

If the conditions of the law of large numbers hold for the squared observations, S^{2} is a consistent estimator of σ^{2}. One can see indeed that the variance of the estimator tends asymptotically to zero. An asymptotically equivalent formula was given in Kenney and Keeping (1951:164), Rose and Smith (2002:264), and Weisstein (n.d.).^{[16]}^{[17]}^{[18]}

Samuelson's inequality

Samuelson's inequality is a result that states bounds on the values that individual observations in a sample can take, given that the sample mean and (biased) variance have been calculated.^{[19]} Values must lie within the limits ${\bar {y}}\pm \sigma _{Y}(n-1)^{1/2}.$

Relations with the harmonic and arithmetic means

It has been shown^{[20]} that for a sample {y_{i}} of positive real numbers,

$\sigma _{y}^{2}\leq 2y_{\max }(A-H),$

where y_{max} is the maximum of the sample, A is the arithmetic mean, H is the harmonic mean of the sample and $\sigma _{y}^{2}$ is the (biased) variance of the sample.

This bound has been improved, and it is known that variance is bounded by

The Lehmann test is a parametric test of two variances. Of this test there are several variants known. Other tests of the equality of variances include the Box test, the Box–Anderson test and the Moses test.

Resampling methods, which include the bootstrap and the jackknife, may be used to test the equality of variances.

This difference between moment of inertia in physics and in statistics is clear for points that are gathered along a line. Suppose many points are close to the x axis and distributed along it. The covariance matrix might look like

That is, there is the most variance in the x direction. Physicists would consider this to have a low moment about the x axis so the moment-of-inertia tensor is

The semivariance is calculated in the same manner as the variance but only those observations that fall below the mean are included in the calculation:

It is also described as a specific measure in different fields of application. For skewed distributions, the semivariance can provide additional information that a variance does not.^{[22]}

If $x$ is a scalar complex-valued random variable, with values in $\mathbb {C} ,$ then its variance is $\operatorname {E} \left[(x-\mu )(x-\mu )^{*}\right],$ where $x^{*}$ is the complex conjugate of $x.$ This variance is a real scalar.

For vector-valued random variables

As a matrix

If $X$ is a vector-valued random variable, with values in $\mathbb {R} ^{n},$ and thought of as a column vector, then a natural generalization of variance is $\operatorname {E} \left[(X-\mu )(X-\mu )^{\operatorname {T} }\right],$ where $\mu =\operatorname {E} (X)$ and $X^{\operatorname {T} }$ is the transpose of $X,$ and so is a row vector. The result is a

variance-covariance matrix

(or simply as the covariance matrix).

If $X$ is a vector- and complex-valued random variable, with values in $\mathbb {C} ^{n},$ then the covariance matrix is$\operatorname {E} \left[(X-\mu )(X-\mu )^{\dagger }\right],$ where $X^{\dagger }$ is the conjugate transpose of $X.$^{[citation needed]} This matrix is also positive semi-definite and square.

As a scalar

Another generalization of variance for vector-valued random variables $X$, which results in a scalar value rather than in a matrix, is the generalized variance$\det(C)$, the determinant of the covariance matrix. The generalized variance can be shown to be related to the multidimensional scatter of points around their mean.^{[23]}

A different generalization is obtained by considering the Euclidean distance between the random variable and its mean. This results in $\operatorname {E} \left[(X-\mu )^{\operatorname {T} }(X-\mu )\right]=\operatorname {tr} (C),$ which is the trace of the covariance matrix.

^Yuli Zhang, Huaiyu Wu, Lei Cheng (June 2012). Some new deformation formulas about variance and covariance. Proceedings of 4th International Conference on Modelling, Identification and Control(ICMIC2012). pp. 987–992.{{cite conference}}: CS1 maint: uses authors parameter (link)

^Loève, M. (1977) "Probability Theory", Graduate Texts in Mathematics, Volume 45, 4th edition, Springer-Verlag, p. 12.

^Bienaymé, I.-J. (1853) "Considérations à l'appui de la découverte de Laplace sur la loi de probabilité dans la méthode des moindres carrés", Comptes rendus de l'Académie des sciences Paris, 37, p. 309–317; digital copy available [1]

^Bienaymé, I.-J. (1867) "Considérations à l'appui de la découverte de Laplace sur la loi de probabilité dans la méthode des moindres carrés", Journal de Mathématiques Pures et Appliquées, Série 2, Tome 12, p. 158–167; digital copy available [2][3]

^Cornell, J R, and Benjamin, C A, Probability, Statistics, and Decisions for Civil Engineers, McGraw-Hill, NY, 1970, pp.178-9.